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
[Fix #3228] idle-timeout
not working in cluster mode
#3235
[Fix #3228] idle-timeout
not working in cluster mode
#3235
Conversation
3afcab8
to
cd57b82
Compare
@@ -146,6 +146,8 @@ def run | |||
# Invoke any worker shutdown hooks so they can prevent the worker | |||
# exiting until any background operations are completed | |||
@config.run_hooks(:before_worker_shutdown, index, @log_writer, @hook_data) | |||
|
|||
Process.kill "SIGTERM", master if server.idle_timeout_reached |
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.
Trapped here:
Lines 323 to 341 in 252890c
master_pid = Process.pid | |
Signal.trap "SIGTERM" do | |
# The worker installs their own SIGTERM when booted. | |
# Until then, this is run by the worker and the worker | |
# should just exit if they get it. | |
if Process.pid != master_pid | |
log "Early termination of worker" | |
exit! 0 | |
else | |
@launcher.close_binder_listeners | |
stop_workers | |
stop | |
@events.fire_on_stopped! | |
raise(SignalException, "SIGTERM") if @options[:raise_exception_on_sigterm] | |
exit 0 # Clean exit, workers were stopped | |
end | |
end |
cd57b82
to
9d51bd3
Compare
assert_raises Errno::ECONNREFUSED, "Connection refused" do | ||
connect | ||
end |
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.
991d0de
to
a412009
Compare
a412009
to
53d73d8
Compare
Sorry, what do you mean? |
Sorry, I might be misunderstanding how releases work... What I'm trying to say is, since the feature was included in https://github.com/puma/puma/releases/tag/v6.4.0, is there a way to include this patch in the same release? π€ |
We (Nate) will have to put out a patch release, 6.4.1. |
Thanks for the great and quick work on this! π₯ |
See #3261 |
Sorry for the question here. Am I understanding that if any single worker hits the idle timeout, it shuts down everything? I was trying this locally ( It seems like the the |
That sounds like a bug to me indeed, and worthy of its own issue so it can be picked up! (Disclaimer: I haven't tested anything myself in regards to this feature) |
I opened #3282 |
Yes that is how this currently works. But,
this does make much more sense to me. I may have jumped the gun on this one before clarifying the exact implementation based off of #3228 (comment) and #3228 (comment). I'll tackle #3282 sometime today/tomorrow if no one's picked it up by then. |
Description
Closes #3228.
Ensures that a worker kills the master process if its server shut down due the the idle timeout elapsing. The master will gracefully shut down the rest of the workers and then itself.
I wonder if we should backport this to https://github.com/puma/puma/tree/v6.4.0 π€Stupid question π€¦π½ββοΈ
Your checklist for this pull request
[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.