-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Distinguish failures to sync stdout and stderr on Linux #370
Labels
Comments
In (actually) thrilling news, newer versions of OS X also don't support syncing stdout. |
Since we don't actually have plans to fix this, I'm going to close this issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reworded and migrated from #328. Whenever logging messages that may crash the program, zap attempts to sync all open
WriteSyncer
s. Briefly, the issue is thatos.Stdout
andos.Stderr
don't reliably support syncing - on Linux, they returnEINVAL
. Ideally, we'd only ignore sync errors from these special files on Linux.However, that's error-prone and difficult to test thoroughly. Instead, we're currently ignoring all sync errors - users can't do anything about failures to sync stderr and stdout, other files are unlikely to fail syncs but accept writes, and other
WriteSyncer
implementations can provide their own observability hooks.Details
The issue here is that
fsync
behaves differently on OSX and Linux. When doing aFatal
, zap callsSync
onos.Stdout
, which ends up callingfsync
.The documentation for
fsync
specifies thatEINVAL
may be returned depending on the type of file passed in, but does not explicitly call out whether it will work for stdout. The Linux documentation says:The OSX documentation is similar:
This simple example reproduces the issue with
fsync
behaving differently:OSX:
Linux:
The text was updated successfully, but these errors were encountered: