Skip to content

Conversation

ArtSin
Copy link
Contributor

@ArtSin ArtSin commented Aug 6, 2025

The variables fiber_scheduler_closed and event_thread_end_hooked are modified between setjmp and longjmp calls. Since they are ints and their addresses are not used, they can be allocated on registers and get clobbered. Fix by making them volatile.

This bug can be observed by adding printfs for the variables before the ifs where they are checked, building with Clang, and running bootstraptest/test_ractor.rb:286. The second time, the variables should be equal to 1, but they are reset to 0.

…clobbering

The variables `fiber_scheduler_closed` and `event_thread_end_hooked` are
modified between `setjmp` and `longjmp` calls. Since they are `int`s and their
addresses are not used, they can be allocated on registers and get clobbered.
Fix by making them `volatile`.

This bug can be observed by adding `printf`s for the variables before the `if`s
where they are checked, building with Clang, and running
`bootstraptest/test_ractor.rb:286`. The second time, the variables should be
equal to 1, but they are reset to 0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant