I have a Rails 5 API with Sidekiq and capistrano-sidekiq that has been happily working fine for the last few months.
The other day, Sidekiq stopped processing jobs. Checking the logs, I saw
bundler: failed to load command: sidekiq (/home/user/project/shared/bundle/ruby/2.2.0/bin/sidekiq)
SignalException: SIGHUP
/home/user/project/shared/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/core_ext/module/attribute_accessors.rb:119:in `<class:Module>'
/home/user/project/shared/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/core_ext/module/attribute_accessors.rb:6:in `<top (required)>'
... (snip)
Whenever I try to start up Sidekiq, the above appears in the log. It was shut down using the quiet command (USR1) and exited properly.
INFO: Received USR1, no longer accepting new work
I'm using Capistrano to deploy, which has worked fine until this happened. This is the command Capistrano used to start Sidekiq:
INFO [2aac3b89] Running $HOME/.rbenv/bin/rbenv exec bundle exec sidekiq --index 0 --pidfile /home/user/project/shared/tmp/pids/sidekiq-0.pid --environment production --logfile /home/user/project/shared/log/sidekiq.log --daemon as [email protected]
DEBUG [2aac3b89] Command: cd /home/user/project/current && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.2.3" ; $HOME/.rbenv/bin/rbenv exec bundle exec sidekiq --index 0 --pidfile /home/user/project/shared/tmp/pids/sidekiq-0.pid --environment production --logfile /home/user/project/shared/log/sidekiq.log --daemon )
INFO [2aac3b89] Finished in 1.176 seconds with exit status 0 (successful).
What is going on? And how can I ensure it doesn't happen in future?
In capistrano, I had :pty
set to true
. I guess it was killing the process before it had a chance to start up. I still am not sure why this is an issue now, but setting :pty
to false
seems to have done the trick.