Skip to content

WIP: SidekiqMiddleware::Shutdown subprocess killer

James Edwards-Jones requested to merge jej/sidekiq-subprocess-killer into master

Why

We sometimes initiate a sidekiq shutdown due to excessive memory usage or gitaly unavailability. Unlike when using ^C to shutdown Sidekiq this sometimes results in processes being left running instead of properly terminating them.

What

Kills direct subprocesses during shutdown.

Uses sys-proctable to retrieve cross-platform process information and uses pgid to find subprocesses in the same process group. These are then sent a SIGTERM just before we force kill the main Sidekiq process.

Steps to reproduce

See https://gitlab.com/gitlab-org/gitlab-ce/issues/40396#note_72179341 where I've also uploaded a video in case we need to manually reverify this or implement more complicated subprocess killing in the future.

Acceptance criteria

Related

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/40396

Edited by James Edwards-Jones

Merge request reports