Heroku - process exited with status 0
Setting up Sidekiq on Heroku should be easy. Everything is so well-described that I didn’t expect any problems.
However, I encountered a small puzzle which took me a while to solve. I’m sharing the answer, because I didn’t manage to find it anywhere and had to come up with it by myself.
This is what we had in Heroku logs:
Starting process with command `bundle exec sidekiq`
State changed from starting to up
Process exited with status 0
State changed from up to crashed
And that’s it. No long exception stacktrace, no verbose errors, no hints - just these 4 lines. I started debugging with:
- searching for the error in Google -> no results
- checking the Redis connection -> Sidekiq web console is working just fine, wrong path
- re-reading Sidekiq documentation about deployment -> no hints there
What I really should do at the beginning is read the logs carefully and think.
Process exited with status 0
. The status code 0 means “everything is fine”. And it was fine from the point of view of Sidekiq. Sidekiq was exiting, because it was running in the daemon mode. Heroku expects processes to run in the foreground mode.
The foreground mode is Sidekiq default setting, but some time ago we added :daemon: true
to config/sidekiq.yml
and forgot about it. Removing this line solved the puzzle!