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
Closed

Rescue StandardError rescues Java errors #1696

grddev opened this issue May 14, 2014 · 2 comments
Milestone

Comments

@grddev
Copy link
Contributor

@grddev 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
Copy link
Contributor

@iconara 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
Copy link
Member

@headius 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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants