-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move signal handling into the MiqServer object #15206
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -345,7 +345,7 @@ def monitor | |
Benchmark.realtime_block(:log_active_servers) { log_active_servers } if threshold_exceeded?(:server_log_frequency, now) | ||
Benchmark.realtime_block(:worker_monitor) { monitor_workers } if threshold_exceeded?(:worker_monitor_frequency, now) | ||
Benchmark.realtime_block(:worker_dequeue) { populate_queue_messages } if threshold_exceeded?(:worker_dequeue_frequency, now) | ||
rescue SystemExit | ||
rescue SystemExit, SignalException | ||
# TODO: We're rescuing Exception below. WHY? :bomb: | ||
# A SystemExit would be caught below, so we need to explicitly rescue/raise. | ||
raise | ||
|
@@ -369,6 +369,13 @@ def monitor_loop | |
_log.info "Server Monitoring Complete - Timings: #{timings.inspect}" unless timings[:total_time] < server_log_timings_threshold | ||
sleep monitor_poll | ||
end | ||
rescue Interrupt => e | ||
_log.info("Received #{e.message} signal, killing server") | ||
self.class.kill | ||
exit 1 | ||
rescue SignalException => e | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note, we're now handling other soft signals I believe. I don't recall why we were only handling term, usr1, and usr2 as soft signals before. Maybe it doesn't matter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was going with "it doesn't matter". Plus I think this is objectively better behavior. The alternative would be to exit the server process with the exception (it was being re-raised previously) and have the workers go down with DRb connection errors. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, let's see what happens and make it more complicated if we need to |
||
_log.info("Received #{e.message} signal, shutting down server") | ||
shutdown_and_exit | ||
end | ||
|
||
def stop(sync = false) | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This got squashed from @Fryguy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fryguy I agree, the alternative was to create a separate method (like
#kill_and_exit
or something) and just call it from here.I thought that was a bit overkill, but I have no real opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just raise instead of exit 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although, to be fair, we were exiting before so I guess that's unchanged behavior.