Skip to content

Commit 296392f

Browse files
slaupsteritsomri
andauthored
ignore EINVAL when flushing logs (#238)
* ignore EINVAL when flushing logs Running the `scheduler` in EKS, every 5 mins an error is logging: ``` failed to flush logs: sync /dev/stderr: invalid argument ``` uber-go/zap#328 details the pain here which comes down to stderr not being syncable in all environments. * Update cmd/scheduler/app/server.go Co-authored-by: Omri Cohen <[email protected]> --------- Co-authored-by: Omri Cohen <[email protected]>
1 parent 8087d97 commit 296392f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmd/scheduler/app/server.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ var logFlushFreq = pflag.Duration("log-flush-frequency", 5*time.Second, "Maximum
4747

4848
func flushLogs() {
4949
if err := log.InfraLogger.Sync(); err != nil &&
50-
!errors.Is(err, syscall.ENOTTY) { // https://github.com/uber-go/zap/issues/991#issuecomment-962098428
50+
!errors.Is(err, syscall.ENOTTY) && // https://github.com/uber-go/zap/issues/991#issuecomment-962098428
51+
!errors.Is(err, syscall.EINVAL) { // https://github.com/uber-go/zap/issues/328
5152
fmt.Fprintf(os.Stderr, "failed to flush logs: %v\n", err)
5253
}
5354
}

0 commit comments

Comments
 (0)