-
Notifications
You must be signed in to change notification settings - Fork 53
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
Option to not send a connection_close
on SIGTERM
#170
Comments
Ok, thank you for your feedback! It makes sense. We will look at this. |
We experience the same issue. |
@orlandothoeny @mruell would #175 be a good solution for you? |
@spuun Yes that looks like it would to the job |
that solution looks like it will work! The way I understand the changes, there will be a new option, to wait after not accepting new connections anymore until we forcefully close them by sending a close message. That's pretty much the same logic as the So if we set the AMQProxy grace period just a little lower than the pod grace period, the workers should have enough time to finish their work and reconnect to a not-terminating pod (they are reconnecting every 15 minutes in-between processing messages, to reconnect to a server accepting new connections). The only downside is, that the worker will not know, that the AMQProxy tries to terminate (without additional monitors), so we have to always reconnect every 15 minutes, just in case. But looks to me that the AMQP protocol just has no way of "softly" notifying a worker/consumer that it wants to shutdown. But the reconnects do not really impact the performance in any meaningful way, so this is the best way to do it I think. Thanks for that and best, |
sorry, last comment was supposed to mention @spuun |
Hi there!
The way we use AMQProxy, we depend on it being able to perform a rolling restart (in a kubernetes cluster).
For that we send a SIGTERM to the AMQProxy.
This commit changed the SIGTERM behaviour though: 98c0bc7 (The
else
in L81 moved inamqproxy.cr
)Now the shutdown is not graceful anymore, since it does not only wait for all clients to disconnect voluntary, but sends a connection close message proactively to the clients.
According to the AMQP reference, that means:
Since this is the official reference, it is also implemented like this in most AMQP client libraries and one can't ignore a connection close message. (See for example in the most popular PHP AMQP client library)
That means one is not able to e.g. finish processing the current message before shutting down, but instead it's possible, that a worker is forced to shutdown while processing a message. This can lead to messages being processed multiple times.
As a quick fix (since we build from source anyway) we use this patch on the file
amqproxy/src/amqproxy.cr
The solutions that come to my mind would be one of these:
Would be happy to hear what you think about this :)
Thanks a lot in advance and best,
Marvin
The text was updated successfully, but these errors were encountered: