alloy / lowdown

A Ruby client for the HTTP/2 version of the Apple Push Notification Service.
MIT License
120 stars 15 forks source link

[very low priority] doesn't work with spring and Rails 4.2.5 #9

Closed snow closed 8 years ago

snow commented 8 years ago

In development environment with spring enabled, either in console or sidekiq worker,

client = Lowdown::Client.production false, certificate: File.read('/path/to/apple_push_notification.pem')`

will get error message "fatal: No live threads left. Deadlock?" When exiting console, will get message "Couldn't cleanly terminate all actors in 10 seconds!"

it works fine without spring.

alloy commented 8 years ago

Thanks for the heads-up! Spring apparently makes use of Process.fork, so the same ‘gotcha’ applies as described in the README. I’ll list Spring there as a know tool that forks.

PS: What version of Sidekiq are you using, >= 4?

snow commented 8 years ago

it's Sidekiq 4.0.1

On Thu, Feb 4, 2016 at 7:07 PM, Eloy Durán notifications@github.com wrote:

Thanks for the heads-up! Spring apparently makes use of Process.fork, so the same ‘gotcha’ applies as described in the README https://github.com/alloy/lowdown#gotchas. I’ll list Spring there as a know tool that forks.

PS: What version of Sidekiq are you using, >= 4?

— Reply to this email directly or view it on GitHub https://github.com/alloy/lowdown/issues/9#issuecomment-179773559.

alloy commented 8 years ago

Pushed https://github.com/alloy/lowdown/commit/aa7424e2b82c3ac2d18ed192519885ed7531b0ff. Seems good enough?

snow commented 8 years ago

well, this issue happens when when creating Lowdown::Client instance after forking, outside Rails initializer, e.g. in Rails console.

So for now, I think it's better to suggest user to remove Spring completely.

nextofsearch commented 8 years ago

I agree with @snow. I wasted more than 2 hours because of this issue.

alloy commented 8 years ago

I’m fine with suggesting that 👍 but please suggest better README changes via a PR.

snow commented 8 years ago

here it comes https://github.com/alloy/lowdown/pull/22