Kernel#trap sometimes throws Java-base exception
------------------------------------------------

                 Key: JRUBY-1880
                 URL: http://jira.codehaus.org/browse/JRUBY-1880
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.x
         Environment: Latest JRuby 1.1b1 from trunk.
            Reporter: Vladimir Sizikov
            Priority: Critical
         Attachments: kernel-trap-exception.patch

Consider the following example:

{noformat}
begin
  trap("USR1") { puts "USR1" }
rescue Exception
  puts "Rescuing..."
end
{noformat}

On my Linux box, the USR1 signal is already taken, and JRuby fails, bypassing 
the rescue clause!
This leads to inability to start Rails with Mongrel server, since Mongrel tries 
to do things similar to
the example above.

Exception in thread "main" java.lang.IllegalArgumentException: Signal already 
used by VM: SIGUSR1
        at sun.misc.Signal.handle(Signal.java:149)
        at org.jruby.RubySignal.__jtrap_kernel(RubySignal.java:102)
        at org.jruby.RubySignalInvoker$__jtrap_kernel_method_3_0.call(Unknown 
Source)
        at org.jruby.runtime.CallSite$ICNonBlockCallSite.call(CallSite.java:167)
        at 
org.jruby.runtime.CallSite$ArgumentBoxingCallSite.call(CallSite.java:100)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:653)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:300)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:627)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:294)
        at 
org.jruby.evaluator.ASTInterpreter.rescueNode(ASTInterpreter.java:1500)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:443)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:175)
        at org.jruby.RubyClass.invoke(RubyClass.java:239)
        at 
org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:343)
        at org.jruby.RubyKernel.trap(RubyKernel.java:831)
        at org.jruby.RubyKernelInvoker$trap_method_1_1.call(Unknown Source)
        at org.jruby.runtime.CallSite$ICBlockCallSite.call(CallSite.java:196)
        at 
ruby.opt.work.samples.test_minus_java_minus_exception_dot_rb.__rescue_1(test-java-exception.rb:2)
        at 
ruby.opt.work.samples.test_minus_java_minus_exception_dot_rb.__file__(test-java-exception.rb:2)
        at 
ruby.opt.work.samples.test_minus_java_minus_exception_dot_rb.load(test-java-exception.rb)
        at org.jruby.Ruby.runScript(Ruby.java:627)
        at org.jruby.Ruby.runNormally(Ruby.java:547)
        at org.jruby.Ruby.runFromMain(Ruby.java:470)
        at org.jruby.Main.runInterpreter(Main.java:213)
        at org.jruby.Main.runInterpreter(Main.java:169)
        at org.jruby.Main.run(Main.java:118)
        at org.jruby.Main.run(Main.java:92)
        at org.jruby.Main.main(Main.java:83)

The provided patch fixes the problem, and I can run Mongrel after that.


-- 
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