From: Joe Leo Date: 2013-01-02T01:20:27+09:00 Subject: GServer in Ruby 2.0.0 --f46d043c8056a6300e04d23c6dee Content-Type: text/plain; charset=ISO-8859-1 I'm working on updating a gem to be compatible with Ruby 2.0 and am currently using Ruby 2.0.0-preview2. I'm running into trouble with a class which inherits from GServer and I think it's related to this bug and subsequent patch . Please look at the gist:https://gist.github.com/4424479 Using Ruby <= 1.9.3, when sending an interrupt signal this code would exit cleanly. Using Ruby 2.0, an exception is thrown on launcher.stop: ~/.rvm/rubies/ruby-2.0.0-preview2/lib/ruby/2.0.0/gserver.rb:116:in `synchronize': can't be called from trap context (ThreadError) from ~/.rvm/rubies/ruby-2.0.0-preview2/lib/ruby/2.0.0/gserver.rb:116:in `stop' As you can see, I am not explicitly calling 'join' in the trap context but 'synchronize' is called as part of GServer#close gserver.rb 114 # Stop the server 115 def stop 116 @connectionsMutex.synchronize { 117 if @tcpServerThread 118 @tcpServerThread.raise "stop" 119 end 120 } 121 end I'm open to any ideas or suggestions. Thanks! --f46d043c8056a6300e04d23c6dee Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I'm working =
on updating a gem to be compatible with Ruby 2.0 and am currently using Rub=
y 2.0.0-preview2. I'm running into trouble with a
class which inherits from GServer and I think it's related to this bug and subsequent patch. Please look at the gist:
https://gist.github.com/4424479=


Using Ruby <=3D 1.9.3, when sending an interrupt signal this code would
exit cleanly. Using Ruby 2.0, an exception is thrown on launcher.stop:

~/.rvm/rubies/ruby-2.0.0-preview2/lib/ruby/2.0.0/gserver.rb:116:in
`synchronize': can't be called from trap context (ThreadError)
    from
~/.rvm/rubies/ruby-2.0.0-preview2/lib/ruby/2.0.0/gserver.rb:116:in
`stop'

As you can see, I am not explicitly calling 'join' in the trap cont=
ext
but 'synchronize' is called as part of GServer#close

gserver.rb
114   # Stop the server
115   def stop
116     @connectionsMutex.synchronize  {
117       if @tcpServerThread
118         @tcpServerThread.raise "stop"
119       end
120     }
121   end

I'm open to any ideas or suggestions. Thanks!
--f46d043c8056a6300e04d23c6dee--