Skip to content
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 #155

Merged
merged 3 commits into from
May 27, 2024
Merged

Conversation

kpamnany
Copy link
Collaborator

@kpamnany kpamnany commented May 27, 2024

PR Description

Re-land #153.

Checklist

Requirements for merging:

  • I have opened an issue or PR upstream on JuliaLang/julia: <link to JuliaLang/julia>
  • I have removed the port-to-* labels that don't apply.
  • I have opened a PR on raicode to test these changes:

kpamnany added 3 commits May 24, 2024 12:11
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.
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.
@github-actions github-actions bot added port-to-v1.10 This change should apply to Julia v1.10 builds port-to-v1.12 This change should apply to Julia v1.12 builds labels May 27, 2024
@kpamnany kpamnany merged commit 3f82711 into v1.10.2+RAI May 27, 2024
8 checks passed
@kpamnany kpamnany deleted the kp-hb-safe-log branch May 27, 2024 19:39
Drvi pushed a commit that referenced this pull request Jun 7, 2024
* Add `jl_inside_heartbeat_thread()`

To allow `jl_safe_printf()` to determine whether it's being called
from the heartbeat thread.

* Write heartbeat thread output to the safe crash log

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.

* Refactor JSON printing code

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.
Drvi pushed a commit that referenced this pull request Jun 7, 2024
* Add `jl_inside_heartbeat_thread()`

To allow `jl_safe_printf()` to determine whether it's being called
from the heartbeat thread.

* Write heartbeat thread output to the safe crash log

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.

* Refactor JSON printing code

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.
@d-netto d-netto removed the port-to-v1.12 This change should apply to Julia v1.12 builds label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
port-to-v1.10 This change should apply to Julia v1.10 builds
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants