Sidekiq long-lasting jobs continue to die

I use sidekiq gem to handle background jobs in Rails. For some reason, the work just freezes after a while - the process either becomes unresponsive, appearing on top , but not much different, or mysteriously disappears without errors (nothing is reported about airbrake.io).

Has anyone had experience?

+6
source share
2 answers

Use the TTIN signal to get backtraces of all threads in the process so you can figure out where the workers are stuck.

https://github.com/mperham/sidekiq/wiki/Signals

+7
source

I experienced this and did not find a solution / root cause.

I could not solve it cleanly, but came up with a hack.

I set up God to control my Sidekiq processes and restart them if the file changed.

Then I set up a Cron job that runs every 5 minutes to check all of the current Sidekiq work sides for the queue. If some% of workers had a start time of <= 5 minutes in the past, this meant that these workers were hanging for some reason. If this happened, I touched a file that made God restart Sidekiq. 5 minutes were ideal for me, but it depends on how long your work lasts.

This is the only way to resolve Sidekiq hanging jobs without checking them every hour, and reloading it yourself.

+1
source

Source: https://habr.com/ru/post/919418/


All Articles