gitlab-org--gitlab-foss/lib/gitlab/sidekiq_middleware
Nick Thomas f0c52df5e5 sidekiq: terminate child processes at shutdown
Sidekiq jobs frequently spawn long-lived child processes to do work.
In some circumstances, these can be reparented to init when sidekiq is
terminated, leading to duplication of work and strange concurrency
problems.

This commit changes sidekiq so that, if run as a process group leader,
it will forward `INT` and `TERM` signals to the whole process group. If
the memory killer is active, it will also use the process group when
resorting to `kill -9` to shut down.

These changes mean that a naive `kill <pid-of-sidekiq>` will now do the
right thing, killing any child processes spawned by sidekiq, as long as
the process supervisor placed it in its own process group.

If sidekiq isn't a process group leader, this new code is skipped.
2019-03-04 09:06:41 -08:00
..
arguments_logger.rb
batch_loader.rb
correlation_injector.rb Log and pass correlation-id between Unicorn, Sidekiq and Gitaly 2018-12-06 20:46:14 +01:00
correlation_logger.rb Log and pass correlation-id between Unicorn, Sidekiq and Gitaly 2018-12-06 20:46:14 +01:00
memory_killer.rb sidekiq: terminate child processes at shutdown 2019-03-04 09:06:41 -08:00
request_store_middleware.rb