ileitch / rapns

MOVED TO https://github.com/rpush/rpush
MIT License
289 stars 92 forks source link

fatal: deadlock detected #194

Open milindphirake opened 10 years ago

milindphirake commented 10 years ago

I implemented the push notifications and GCM notifications using this gem working great.

@ileitch

But i came across one strange issue. Sometimes my rails server goes into deadlock state.

Any Help on this will be great

I got the following log.

It cames when there is noting to push and we call "Rapns.push"

Log= >

Rapns::Notification Load (0.6ms) SELECT rapns_notifications.* FROM rapns_notifications WHERE (delivered = 0 AND failed = 0 AND (deliver_after IS NULL OR deliver_after < '2014-01-22 17:30:48')) AND (app_id IN (1,2,3,4)) => {}

1.9.3-p484 :005 > Rapns.push

(0.3ms) SELECT COUNT(_) FROM rapns_apps Rapns::App Load (0.2ms) SELECT rapns_apps._ FROM rapns_apps Rapns::Notification Load (0.6ms) SELECT rapns_notifications.* FROM rapns_notifications WHERE (delivered = 0 AND failed = 0 AND (deliver_after IS NULL OR deliver_after < '2014-01-22 17:30:55')) AND (app_id IN (1,2,3,4)) fatal: deadlock detected from /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/gems/rapns-3.3.2/lib/rapns/daemon/delivery_handler.rb:21:in join' from /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/gems/rapns-3.3.2/lib/rapns/daemon/delivery_handler.rb:21:instop' from /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/gems/rapns-3.3.2/lib/rapns/daemon/app_runner.rb:81:in map' from /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/gems/rapns-3.3.2/lib/rapns/daemon/app_runner.rb:81:instop' from /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/gems/rapns-3.3.2/lib/rapns/daemon/app_runner.rb:46:in map' from /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/gems/rapns-3.3.2/lib/rapns/daemon/app_runner.rb:46:instop' from /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/gems/rapns-3.3.2/lib/rapns/push.rb:15:in push' from (irb):5 from /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.6/lib/rails/commands/console.rb:47:instart' from /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in start' from /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.6/lib/rails/commands.rb:41:in<top (required)>' from script/rails:6:in require' from script/rails:6:in

' 1.9.3-p484 :006 >

ileitch commented 10 years ago

Thanks for reporting. I suspect this is fixed in 3.4.1 (but that release has some other bugs). I'm close to releasing 4.0, I will try reproduce this.