Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: JRuby 1.6.2, JRuby 1.6.3
-
Fix Version/s: None
-
Component/s: None
-
Environment:MacOS X Lion 10.7.1
rvm 1.7.2
JRuby 1.6.3
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
-
Number of attachments :
Description
I have found a strange behavior when trying to restart rails app. Webrick shows me that default port 3000 is already binded, to restart I need to "ps ax | grep java" and kill -9 this process.
After some googling and researching I have found that JRuby doesn't properly work with Kernel.trap method on my laptop (Mac OS X Lion 10.7.1, rvm 1.7.2, jruby 1.6.3, Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511c).
Here is some ruby code to test described behavior (some.rb):
Kernel.trap(:INT)
{ puts "interrupted = true"; exit } loop do
puts ". "
sleep 1
end
And here is steps to reproduce:
$ rvm use ree
Using /Users/cr0t/.rvm/gems/ree-1.8.7-2011.03
$ ruby some.rb
.
.
^Cinterrupted = true
We can see that block given to the trap method is executed successfully ("interrupted = true" printed out before exiting), so next we will try to run code above via JRuby interpreter.
$ rvm use jruby
Using /Users/cr0t/.rvm/gems/jruby-1.6.3
$ ruby some.rb
.
.
^C
$ rvm version
rvm 1.7.2 by Wayne E. Seguin (wayneeseguin@gmail.com) https://rvm.beginrescueend.com/
Could anyone help to fix this issue (it's really annoying when working with rails)? Or anyone who can reproduce such behavior?
I've also test this code and JRuby on another machines.
Ubuntu 10.04 + rvm 1.7.2 + jruby 1.6.3 + Java(TM) SE Runtime Environment (build 1.6.0_26-b03): Kernel.trap works successfully.
MacOS X Snow Leopard 10.6.6 + rvm 1.7.2 + jruby 1.6.3 + Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425): Kernel.trap works successfully.