Exceptions do not cut off at binding evals after change reported in JRUBY-2945
------------------------------------------------------------------------------

                 Key: JRUBY-2948
                 URL: http://jira.codehaus.org/browse/JRUBY-2948
             Project: JRuby
          Issue Type: Bug
            Reporter: Charles Oliver Nutter
            Assignee: Charles Oliver Nutter
             Fix For: JRuby 1.1.5


The change associated with JRUBY-2945 improved the speed of stack traces 
significantly, but introduced various incompatibilities into the stack trace 
generation (not that it was perfect before, but it made it worse in places). 
One area that become problematic to represent was whether a stack frame was a 
"binding frame". Under certain circumstances (like for normal stack traces) 
eval with binding represents a point that gets chopped off in the backtrace. 
Because the new code uses StackTraceElement to represent the Ruby backtrace 
frames, it does not have a flag for binding frame.

The fix for this would be to no longer use StackTraceElement, unfortunately, 
since hacks to put in a "special" class or file or method name all interfere 
with other aspects of backtrace generation (and are ugly to boot). This would 
allow us to still have fast backtrace memoizing at exception construction time, 
but would break the rather nice feature where the Ruby backtrace can be a Java 
backtrace as-is.

Unfortunately this fix is not going to get into 1.1.4, and the perf 
improvements for exceptions are high enough I think we'll accept this as a 
minor version-to-version regression and address it in 1.1.5.

For the record, here's how to reproduce:

{noformat}
def foo
  eval "bar", binding
end

def bar
  raise
end

foo
{noformat}

The Ruby backtrace looks like

{noformat}~/NetBeansProjects/jruby ➔ ruby test.rb
test.rb:6:in `bar': unhandled exception
        from test.rb:2:in `foo'
        from test.rb:2:in `foo'
        from test.rb:9
{noformat}

The JRuby trace looks like:

{noformat}
~/NetBeansProjects/jruby ➔ jruby test.rb
test.rb:6:in `bar': unhandled exception
        from test.rb:2:in `binding'
        from test.rb:2:in `eval'
        from test.rb:2:in `foo'
        from test.rb:9
{noformat}

In 1.1.3, it looked like:

{noformat}
~/NetBeansProjects/jruby ➔ ../jruby-1_1_3/bin/jruby test.rb
test.rb:6:in `bar': unhandled exception
        from test.rb:9:in `foo'
{noformat}

Obviously there's goofy differences for all these here.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to