-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Global variables read stale values #4797
Comments
There seems to be other thread safety issues in the implementation of globals:
|
Nice find, thanks. I feel like the way our globals are structured needs a reboot (the current way is WAY over-abstracted) but I'll have a look at fixing this in place for now. |
There are numerous races involved in caching this value, so while we work to replace the global var subsystem we should disable the value cache. See #4797.
There are numerous races involved in caching this value, so while we work to replace the global var subsystem we should disable the value cache. See #4797.
A fix is in for 9.1.14 that basically just disables the caching like @eregon did. I am resolving this as fixed and will file a separate bug for the many race conditions we need to deal with. |
Environment
Global variable reads should behave as if they are volatile, so they always get the latest value.
However, it seems the invokedynamic implementation is not thread-safe or make some of the reads just get stale values, and never see the new value.
See bug_jruby_globals.rb to reproduce.
It accepts a number of threads as an argument.
Locally, the script never terminates with 4 threads, it does 1 to ~5 iterations and gets stuck.
Passing
-Xinvokedynamic.global.maxfail=0
solves the problem so it seems related to invokedynamic globals. Running on MRI or TruffleRuby (which also treat global variables as constants until they are changed) also works fine.The text was updated successfully, but these errors were encountered: