From e729fe81f0d50266e65259a55dc2c8d963515dec Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Wed, 16 Aug 2017 16:42:11 -0500 Subject: [PATCH 1/2] Fix typo with @sigterm_received instance variable --- app/models/miq_worker/runner.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/miq_worker/runner.rb b/app/models/miq_worker/runner.rb index dae0a883b8a..f5373cfd7ee 100644 --- a/app/models/miq_worker/runner.rb +++ b/app/models/miq_worker/runner.rb @@ -343,7 +343,7 @@ def do_work_loop # Should be caught by the rescue in `#start` and will run do_exit from # there. - raise Interrupt if @sigterm_recieved + raise Interrupt if @sigterm_received do_gc self.class.log_ruby_object_usage(worker_settings[:top_ruby_object_classes_to_log].to_i) @@ -469,8 +469,8 @@ def self.log_ruby_object_usage(top = 20) # received from the container management system (aka OpenShift). The SIGINT # trap is mostly a developer convenience. def setup_sigterm_trap - Kernel.trap("TERM") { @sigterm_recieved = true } - Kernel.trap("INT") { @sigterm_recieved = true } + Kernel.trap("TERM") { @sigterm_received = true } + Kernel.trap("INT") { @sigterm_received = true } end protected From 124cdd9ce7f711e95678c8d3a0a4c7270b0c128d Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Wed, 16 Aug 2017 16:42:26 -0500 Subject: [PATCH 2/2] Initialize @sigterm_received instance variable This will only be used if `#setup_sigterm_trap` is called (which currently only is called from the `run_single_worker.rb` script, but this make sure that it doesn't cause warnings in ruby when it is... --- app/models/miq_worker/runner.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/miq_worker/runner.rb b/app/models/miq_worker/runner.rb index f5373cfd7ee..e854074ee90 100644 --- a/app/models/miq_worker/runner.rb +++ b/app/models/miq_worker/runner.rb @@ -48,6 +48,7 @@ def initialize(cfg = {}) $log ||= Rails.logger @server = MiqServer.my_server(true) + @sigterm_received = false worker_initialization after_initialize