You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ruby 2 checks for deadlockable code and the way we are using signal handlers, with logging inside handlers is in this case:
log writing failed. can't be called from trap context
/usr/lib/ruby/2.1.0/monitor.rb:185:in lock': can't be called from trap context (ThreadError) from /usr/lib/ruby/2.1.0/monitor.rb:185:inmon_enter'
from /usr/lib/ruby/2.1.0/monitor.rb:209:in mon_synchronize' from /usr/lib/ruby/vendor_ruby/dbi.rb:231:inload_driver'
from /usr/lib/ruby/vendor_ruby/dbi.rb:149:in _get_full_driver' from /usr/lib/ruby/vendor_ruby/dbi.rb:134:inconnect'
from /usr/local/share/cigri/lib/cigri-iolib.rb:44:in db_connect' from /usr/local/share/cigri/lib/cigri-iolib.rb:1606:ininitialize'
from /usr/local/share/cigri/lib/cigri-eventlib.rb:78:in initialize' from /usr/local/share/cigri/modules/judas.rb:90:innew'
from /usr/local/share/cigri/modules/judas.rb:90:in notify' from /usr/local/share/cigri/modules/judas.rb:107:inblock in
'
from /usr/local/share/cigri/modules/judas.rb:113:in call' from /usr/local/share/cigri/modules/judas.rb:113:insleep'
from /usr/local/share/cigri/modules/judas.rb:113:in `'
A simple workaround should be to create a Thread for all logger inside a trap, but I'm not sure that it's clean:
Thread.new do
logger.debug("Spawned #{mod} process #{modpid}")
end
We have to re-code completely the signal handling of the modules almighty and judas to implement "deferred signal handling".
A nice example may be found here: ddollar/foreman@5ab08c6
Ruby 2 checks for deadlockable code and the way we are using signal handlers, with logging inside handlers is in this case:
'log writing failed. can't be called from trap context
/usr/lib/ruby/2.1.0/monitor.rb:185:in
lock': can't be called from trap context (ThreadError) from /usr/lib/ruby/2.1.0/monitor.rb:185:in
mon_enter'from /usr/lib/ruby/2.1.0/monitor.rb:209:in
mon_synchronize' from /usr/lib/ruby/vendor_ruby/dbi.rb:231:in
load_driver'from /usr/lib/ruby/vendor_ruby/dbi.rb:149:in
_get_full_driver' from /usr/lib/ruby/vendor_ruby/dbi.rb:134:in
connect'from /usr/local/share/cigri/lib/cigri-iolib.rb:44:in
db_connect' from /usr/local/share/cigri/lib/cigri-iolib.rb:1606:in
initialize'from /usr/local/share/cigri/lib/cigri-eventlib.rb:78:in
initialize' from /usr/local/share/cigri/modules/judas.rb:90:in
new'from /usr/local/share/cigri/modules/judas.rb:90:in
notify' from /usr/local/share/cigri/modules/judas.rb:107:in
block infrom /usr/local/share/cigri/modules/judas.rb:113:in
call' from /usr/local/share/cigri/modules/judas.rb:113:in
sleep'from /usr/local/share/cigri/modules/judas.rb:113:in `'
A simple workaround should be to create a Thread for all logger inside a trap, but I'm not sure that it's clean:
Thread.new do
logger.debug("Spawned #{mod} process #{modpid}")
end
An interesting discussion about that: http://www.mikeperham.com/2013/02/23/signal-handling-with-ruby/
The text was updated successfully, but these errors were encountered: