Skip to content
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

Fix raw and varargs backtrace elements #6877

Merged
merged 2 commits into from Oct 5, 2021
Merged

Conversation

headius
Copy link
Member

@headius headius commented Oct 5, 2021

Two fixes here:

  • Fix the "raw" backtrace mode. Both "raw" and "full" were printing out all frames, but "raw" was improperly processing jitted frames into their Ruby method names like "full". I believe this was due to my unifying these two paths; "raw" passed in an empty set of interpreter frames, which prevented interpreter frames from being processed, but it still processed jitted method names. A new flag was added to indicate "raw" behavior, now skipping the jit frame rewriting.
  • Fix the varargs method wrappers from JIT being included in exception traces. In Handle varargs frame on arity error in jitted code #6771 I fixed the backtrace generation to include the JIT varargs wrapper, which previously had been ignored. However I messed up the guard that prevents those frames from being processed if the wrapped method also appears in the trace (varargs frame should only show up if it appears alone, as in arity errors). The fix is to remove the expectation of the "varargs" frame marker, since they still show up as "method" type. Fixes Unexpected frame in stack trace from caller method with create_method invocation #6846.

The varargs frame check expected the parsed frame type to be
"varargs", but this type is not produced when processing the jit
method names. Varargs wrappers are seen as "method" which led to
them being included twice.

The fix here stops expecting the "varargs" frame type and relies
on the method name check, which is essentially the same.

Fixes jruby#6846
@headius headius added this to the JRuby 9.3.1.0 milestone Oct 5, 2021
@headius
Copy link
Member Author

headius commented Oct 5, 2021

Second fix in action... both of these show just one "foo" frame even though they both pass through the varargs frame. The first triggers an arity error within the varargs wrapper, and the second raises within the real method body. The second case is taken from #6846.

$ jruby -e 'def foo(a); raise; end; def bar; a = [1,2]; foo(*a); end; bar'
ArgumentError: wrong number of arguments (given 2, expected 1)
     foo at -e:1
     bar at -e:1
  <main> at -e:1

$ jruby -e 'def foo(a); raise; end; def bar; a = [1]; foo(*a); end; bar'
RuntimeError: No current exception
     foo at -e:1
     bar at -e:1
  <main> at -e:1

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.

Unexpected frame in stack trace from caller method with create_method invocation
1 participant