-
Notifications
You must be signed in to change notification settings - Fork 124
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
Channel closure on genserver shutdown #186
Comments
Don't see any way of closing a channel when it has errored like that. |
Interesting! Confirmed that the channel process goes down without closing the channel properly. Since amqp_client suggests to close channel explicitly, I am not sure if the upstream library would be interested. it's worth trying though. My suggestions:
|
In general, consumers in RabbitMQ clients do not close channels when they run into an unhandled exception. Java client behaved this In addition it matters if the consumer was shut down cleanly or terminated abnormally. In case of a clean shutdown Erlang (and Elixir by proxy) allows you to link two processes so that they go down together. Libraries such as the RabbitMQ AMQP 0-9-1 client or this Elixir façade to it really should not be too opinionated because usually it is easy enough for your |
We suffer from a similar issue with |
I continued it here findings are mostly is when you consume and not close the channel correctly but the process goes down it can crash the consumer which can crash the channel genservers without actually closing the connection. |
hey @michaelklishin. thanks for jumping in the issue - great to get feedback from rabbitmq team. I think this Github issue is discussing a few different things. I would like to clarify here.
Like the document of Erlang DirectConsumer states, you should close the channel explicitly.
This means - when the consumer is unexpectedly down it can cause the connection error. I am concerned with this issue. While I leave the discussion to the rabbitmq team Elixir library would provide two options.
|
#192 will provide a workaround for the issue. I also added more information in the moduledoc. I will leave the connection error discussion in the upstream library. I am closing the issue but feel free to reopen if any actions needed from this library. thanks! |
Hello, I am not sure if I understand correctly the different comments here. With the current implementation, does the channel get automatically cleaned up if the process that called Thank you. |
This issue is a bit of a continuation on issue #174 and MR #184.
When using DirectConsumer I would expect the channel to close when the GenServer stops.
But when DynamicSupervisor.terminate_child is used you get the issue at the bottom of this issue.
The MR I linked is a kind of fix on this that you no longer see the errors but the channel also won't close.
On this error below the channel also doesn't close but amqp also no longer tracks the channel causing the next error when you try to open a new channel on the same connection.
11:06:31.022 [warn] Connection (#PID<0.289.0>) closing: received hard error {:"connection.close", 504, "CHANNEL_ERROR - second 'channel.open' seen", 20, 10} from server
Currently still researching how I can force connection to correctly close without calling Channel.close in the genserver. This is mostly that when it crashes it should be closed correctly either way. Because else you get random channel leaks that won't truly resolve.
After doing more research and building a test case app you can reproduce it following the calls in the code block below.
https://github.com/nulian/rabbit_test
The text was updated successfully, but these errors were encountered: