Silent exit when using mysql-je jar from JRuby

There’s a certain ancient Java library that I sometimes use from
JRuby, and I’ve noticed that when it fails, JRuby exits silently with
an exit value of 1. begin…rescue…end doesn’t capture it, and the
at_exit proc isn’t executed. I’ve noticed this bug probably since the
1.5 series up to 1.6.7, in 1.8 and 1.9 modes.

The Java library in question is mysql-je – a barebones library that
can do basic MySQL access using local files (using the same layout and
format as the files in an actual MySQL server). The error occurs when
the database files are read-only or opened by another process. I know
there are other, better, ways to access on-disk databases; my purpose
is just to point out this bug, since I think JRuby should be able to
handle a failure in an external jar.

What more information can I provide to help debug it? The library
depends on a native MySQL library for Linux, Mac OS X, or Windows. I
believe I have all three libraries (in 32-bit only except for Linux),
along with the jar, but I’m not sure where I can upload them (or
whether anyone would trust binaries I supply). I suppose I could ask
that others build the native libraries from source, but I had trouble
even finding the right MySQL version, and didn’t document the build
process as I should have.

On 2012-02-24, at 00:37, Eric C. wrote:

There’s a certain ancient Java library that I sometimes use from
JRuby, and I’ve noticed that when it fails, JRuby exits silently with
an exit value of 1. begin…rescue…end doesn’t capture it, and the
at_exit proc isn’t executed. I’ve noticed this bug probably since the
1.5 series up to 1.6.7, in 1.8 and 1.9 modes.

Have you tried this?

begin

rescue Exception

end

By default, “rescue” catches StandardError, and java.lang.Throwable is
not a subclass of this. java.lang.Throwable is treated as a subclass of
the Ruby Exception class.


Uwe K.
[email protected]
http://kubosch.no/

On Mon, Mar 26, 2012 at 7:05 AM, Uwe K. [email protected] wrote:

begin

rescue Exception

end

By default, “rescue” catches StandardError, and java.lang.Throwable is not a
subclass of this. java.lang.Throwable is treated as a subclass of the Ruby
Exception class.

Yes. No exception is caught.

sounds like a hard crash. Pretty rare with the JVM.
maybe this or catching “throwable” would help//work:
http://stackoverflow.com/questions/61714/how-to-capture-crash-logs-in-java