JRuby returns nil backtrace for living newborn threads, whereas MRI returns [] #4891
Milestone
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. |
headius
added a commit
that referenced
this issue
Dec 11, 2017
eregon
added a commit
to ruby/spec
that referenced
this issue
Jan 6, 2018
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: