Kubernetes Deployments Can Kill Long-Running Sidekiq Jobs Mid-Execution
A DEV Community article explains that background jobs running on Sidekiq workers in Kubernetes were quietly dying during deployments. The cause is a mismatch between Kubernetes' pod termination sequence and Sidekiq's shutdown behavior: Kubernetes sends SIGTERM and then SIGKILL after a 30-second default grace period, while Sidekiq's default shutdown timeout is 25 seconds. Jobs still running at the deadline can be pushed back to Redis and rerun from scratch, causing duplicated work, or be killed outright and lost. The author notes that symptoms like unexpected retries, duplicated effects, and abrupt worker logs appear specifically around deploys, scale-downs, and node drains. The article goes on to describe a fix involving a preStop hook, adjusted grace periods, and configuration changes, along with testing guidance.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in