-
Notifications
You must be signed in to change notification settings - Fork 0
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
Write heartbeat thread output to safe crash log #153
Conversation
To allow `jl_safe_printf()` to determine whether it's being called from the heartbeat thread.
In `jl_safe_printf()`, we're already writing to the safe crash log if we're in signal handler context (in addition to writing to `stderr`). Now we do the same if we're in the heartbeat thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Lgtm except for some buffer math questions. Would be good to print what we can if possible, and best if we could print it all!
Concurrent `write()` calls to the same file descriptor should be thread-safe, but can result in interleaving. Refactor the JSON printing code used from `jl_safe_printf()` to assemble the message into a buffer and use a single `write()` call.
Improved the "JSONification" implementation based on @NHDaly's comments. My first stab at this was to use |
I've tested this locally, starting Julia with
|
Ohhhhhh too bad - So we're still going to get one json message per line in the safe printf in the julia task stacktraces? I was incorrectly believing this PR would also be combining the whole report into one json message, which would be nicer to consume, but I guess would be annoying to implement. So that will have to wait for a future PR, yeah? |
Yes, it's one JSON message per line. To do what you're thinking would require changing how |
PR Description
#140 added the
--safe-crash-log-file
command line argument. When this is specified, and when in signal handler context,jl_safe_printf
additionally writes whatever it is printing to the file in JSON format.With this PR,
jl_safe_printf
writes to the file in JSON format from the heartbeat thread's context also.This PR also refactors the JSON printing function to use a single
write
call rather than multiple, to reduce the possibility of output from multiple threads being interleaved.Checklist
Requirements for merging:
port-to-*
labels that don't apply.