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
Potential bug in internal/runtime/ThreadService? #4844
Comments
Yeah seems like this should be Luckily, it turns out we don't use the I'll leave the flag, for API and info purposes, but I'll fix it to be |
Yeah, this flag was all over the place. I also found the following logic, which seems to disable polling when there's one (or zero?) threads, so this isn't even internally consistent. I'm removing the field, deprecating everything involving it, and modifying |
Also worth noting that the access to the map is costly (slower thread init/teardown times), non-atomic (so it's only useful for an immediately-stale point-in-time snapshot) and the boolean is also non-atomically updated, so threads can step on each other. Just a half-baked feature that never landed. |
Thanks for the fix! |
jruby/core/src/main/java/org/jruby/internal/runtime/ThreadService.java
Line 292 in 8ea1605
Here, and a bit below, a Map's (a synchronized WeakHashMap) size is checked as being >= 0 to twiddle the state of the
polling
field.I'm pretty sure WeakHashMap would never return a size < 0. I haven't fully grasped the rest of the file (should this only be set iff there's more than 1 active thread?), but certainly
if (map.size() >= 0)
is always going to be true.The text was updated successfully, but these errors were encountered: