-
-
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
JRuby returns nil backtrace for living newborn threads, whereas MRI returns [] #4891
Comments
So the mismatch is that we return nil when there's no trace and MRI returns an empty array, yes? |
@ivoanjo I know this behavior is a little fiddly, but maybe you can come up with a spec? |
Yeah, that's the behavior I'm seeing.
May take a few days due to x-mas shopping, but will do 👍 |
Looks like I broke something by making all cases return []:
Investigating. |
On MRI, immediately after a Thread gets created and before it starts executing, its backtrace is an empty array. This behavior changed from 2.0 onwards. On 1.9 it returned nil. Testing for the backtrace of a recently-created Thread is an inherently racy operation, so instead of specifically testing for an empty Array let's at least test that we get **an** Array, which seems enough to guarantee same-ish behavior. See jruby/jruby#4891
Environment
jruby 9.1.15.0 (2.3.3) 2017-12-07 929fde8 Java HotSpot(TM) 64-Bit Server VM 25.151-b12 on 1.8.0_151-b12 +jit [linux-x86_64]
Linux u186024434db159d25c92 4.10.0-38-generic #42~16.04.1-Ubuntu SMP Tue Oct 10 16:32:20 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 16.04.3 LTS
Expected Behavior
Example code:
Output on MRI 2.0 to 2.5 (this seems to have changed from 1.9, where it returned
nil
):(This is of course a race and may sometimes yield non-empty results)
Actual Behavior
Output on JRuby:
The text was updated successfully, but these errors were encountered: