1. 07 Mar, 2019 1 commit
  2. 04 Mar, 2019 1 commit
    • Nick Thomas's avatar
      sidekiq: terminate child processes at shutdown · f0c52df5
      Nick Thomas authored
      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.
      f0c52df5