From 12bc7e0bab2ba1e0678066f5394029213ca40333 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Thu, 7 Mar 2019 12:37:59 +0000 Subject: [PATCH] Fix Sidekiq process group killing --- lib/gitlab/sidekiq_signals.rb | 7 +++++-- spec/lib/gitlab/sidekiq_signals_spec.rb | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/sidekiq_signals.rb b/lib/gitlab/sidekiq_signals.rb index b704ee9a0a9..82462544d07 100644 --- a/lib/gitlab/sidekiq_signals.rb +++ b/lib/gitlab/sidekiq_signals.rb @@ -35,8 +35,11 @@ module Gitlab # signals from outside the process group, but that isn't fatal. def self.blindly_signal_pgroup!(signal) old_trap = trap(signal, 'IGNORE') - Process.kill(signal, "-#{Process.getpgrp}") - trap(signal, old_trap) + begin + Process.kill(signal, 0) + ensure + trap(signal, old_trap) + end end end end diff --git a/spec/lib/gitlab/sidekiq_signals_spec.rb b/spec/lib/gitlab/sidekiq_signals_spec.rb index 4483224f49d..77ecd1840d2 100644 --- a/spec/lib/gitlab/sidekiq_signals_spec.rb +++ b/spec/lib/gitlab/sidekiq_signals_spec.rb @@ -44,7 +44,7 @@ describe Gitlab::SidekiqSignals do expect(Process) .to receive(:kill) - .with(signal, "-#{Process.pid}") + .with(signal, 0) .ordered expect(described_class)