diff --git a/bin/sidekiqctl b/bin/sidekiqctl index e9854680..ad7dfee5 100755 --- a/bin/sidekiqctl +++ b/bin/sidekiqctl @@ -64,7 +64,7 @@ class Sidekiqctl end def quiet - `kill -USR1 #{pid}` + `kill -TSTP #{pid}` end def stop diff --git a/bin/sidekiqload b/bin/sidekiqload index 25c71188..e874d892 100755 --- a/bin/sidekiqload +++ b/bin/sidekiqload @@ -46,7 +46,7 @@ Toxiproxy.populate([{ }]) self_read, self_write = IO.pipe -%w(INT TERM USR1 USR2 TTIN).each do |sig| +%w(INT TERM TSTP TTIN).each do |sig| begin trap sig do self_write.puts(sig) @@ -67,14 +67,9 @@ def handle_signal(launcher, sig) when 'TERM' # Heroku sends TERM and then waits 10 seconds for process to exit. raise Interrupt - when 'USR1' - Sidekiq.logger.info "Received USR1, no longer accepting new work" + when 'TSTP' + Sidekiq.logger.info "Received TSTP, no longer accepting new work" launcher.quiet - when 'USR2' - if Sidekiq.options[:logfile] - Sidekiq.logger.info "Received USR2, reopening log file" - Sidekiq::Logging.reopen_logs - end when 'TTIN' Thread.list.each do |thread| Sidekiq.logger.warn "Thread TID-#{thread.object_id.to_s(36)} #{thread['label']}" diff --git a/examples/upstart/sidekiq.conf b/examples/upstart/sidekiq.conf index 0bcdaa9f..cb1d7149 100644 --- a/examples/upstart/sidekiq.conf +++ b/examples/upstart/sidekiq.conf @@ -40,7 +40,7 @@ normal exit 0 TERM # Older versions of Upstart might not support the reload command and need # this commented out. -reload signal USR1 +reload signal TSTP # Upstart waits 5 seconds by default to kill the a process. Increase timeout to # give sidekiq process enough time to exit. diff --git a/test/helper.rb b/test/helper.rb index 5c92b0f4..7da4c862 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -12,12 +12,12 @@ if ENV["COVERAGE"] end ENV['RACK_ENV'] = ENV['RAILS_ENV'] = 'test' -trap 'USR1' do +trap 'TSTP' do threads = Thread.list puts puts "=" * 80 - puts "Received USR1 signal; printing all #{threads.count} thread backtraces." + puts "Received TSTP signal; printing all #{threads.count} thread backtraces." threads.each do |thr| description = thr == Thread.main ? "Main thread" : thr.inspect diff --git a/test/test_cli.rb b/test/test_cli.rb index 2939e57d..3a55762a 100644 --- a/test/test_cli.rb +++ b/test/test_cli.rb @@ -335,7 +335,7 @@ class TestCli < Sidekiq::Test end end - describe 'handles USR1 and USR2' do + describe 'handles TSTP and USR2' do before do @tmp_log_path = '/tmp/sidekiq.log' @cli.parse(['sidekiq', '-L', @tmp_log_path, '-r', './test/fake_env.rb'])