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

Rescue StandardError rescues Java errors #1696

Closed
grddev opened this Issue May 14, 2014 · 2 comments

Comments

Projects
None yet
4 participants
@grddev
Copy link
Contributor

grddev commented May 14, 2014

The following example program prints [:error, java.lang.OutOfMemoryError: Java heap space], and exits with zero exit code, although I would have expected it not to

begin
  str = 'xxx'
  loop do
    str *= 2;
  end
rescue => e
  p [:error, e]
end
@iconara

This comment has been minimized.

Copy link
Contributor

iconara commented May 14, 2014

To me this is a major issue. This means that an application that contains rescue => e cannot be relied on to behave well under error conditions.

This is what Java says about java.lang.Error:

An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch.

For a long time we've known that rescue Exception rescued these errors, but it seems like this was introduced in 1.7.1 (this is the commit: 6b13c46), and we didn't notice until now.

If we send a patch, can we get this fixed in 1.7.13?

@headius

This comment has been minimized.

Copy link
Member

headius commented May 14, 2014

This is a bug. We do rescue Throwable for Object and Exception, but I don't think we should be doing it for StandardError...or StandardError should correspond to something like non-Error/RuntimeException descendants of Throwable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.