redis_failover icon indicating copy to clipboard operation
redis_failover copied to clipboard

Shutdown fails with Ruby 2.0

Open mperham opened this issue 11 years ago • 3 comments

You can't take a mutex from a signal handler in Ruby 2.0+. Here's what Sidekiq does to get around this limitation:

https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/cli.rb#L73

log writing failed. can't be called from trap context
/Users/mperham/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/monitor.rb:185:in `lock': can't be called from trap context (ThreadError)
    from /Users/mperham/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/monitor.rb:185:in `mon_enter'
    from /Users/mperham/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/monitor.rb:209:in `mon_synchronize'
    from /Users/mperham/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/redis_failover-1.0.2/lib/redis_failover/node_manager.rb:99:in `shutdown'
    from /Users/mperham/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/redis_failover-1.0.2/lib/redis_failover/runner.rb:21:in `block (2 levels) in trap_signals'

mperham avatar Dec 30 '13 06:12 mperham

Honestly I haven't used Ruby 2.0+ at all. I don't work with Ruby on a daily basis any more so all of my testing is stuck on 1.9.x, unfortunately. I'll try to test it on 2.0 at some point, but I really don't have the spare cycles for the next few weeks at least (big release at work). If you have any spare cycles and think it's an easy fix, then please go ahead and submit a PR. Also, note that the master branch has some nice fixes that haven't been pushed out to rubygems yet. I still need to cut a new release, but in the mean meantime you might want to use the master github repo in your gemfile for now.

ryanlecompte avatar Dec 30 '13 15:12 ryanlecompte

Have you considered finding a new maintainer? I know you've been in the scala community for a while. Perhaps someone more active in Ruby could help?

For the record, I'm not interested in expanding my projects or I'd volunteer.

On Dec 30, 2013, at 7:18, Ryan LeCompte [email protected] wrote:

Honestly I haven't used Ruby 2.0+ at all. I don't work with Ruby on a daily basis any more so all of my testing is stuck on 1.9.x, unfortunately. I'll try to test it on 2.0 at some point, but I really don't have the spare cycles for the next few weeks at least (big release at work). If you have any spare cycles and think it's an easy fix, then please go ahead and submit a PR. Also, note that the master branch has some nice fixes that haven't been pushed out to rubygems yet. I still need to cut a new release, but in the mean meantime you might want to use the master github repo in your gemfile for now.

— Reply to this email directly or view it on GitHub.

mperham avatar Dec 30 '13 19:12 mperham

Excellent idea: https://twitter.com/ryanlecompte/status/417744677790425089

ryanlecompte avatar Dec 30 '13 19:12 ryanlecompte