-
Notifications
You must be signed in to change notification settings - Fork 38
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
Exception handling #24
Conversation
This allows users of the library to actually catch and handle exceptions.
…ers of the library.
…ected connection closings.
How will this address exceptions happening on the channel threads? I have used setUncaughtExceptionHandler in my code to catch those, and have seen this one: "recv: timeout (Operation timed out)" happening consistently when a stateful firewall closes the connection after a long period (2hours) of inactivity. It would be a real improvement if this instead went to the connectionClosedHandler. |
The recv exception most likely belonged to the connection itself and not to any one channel. This probably happened in an earlier version of the library, right? Because recently I switch from sockets to handles, so there's no call to recv anymore. |
Yes, this was before the switch to handles. I just tested this again last night. In the most recent version nothing happens, that is, a client consumer just silently ceases to receive anything. No exceptions thrown. This is the worst of all possibilities. Heartbeats would solve this, but I feel the library should signal something as well. One way to test is simply to have a client connect to RabbitMQ, then yank out the network cable from your switch. As you can see, nothing happens on the client. |
I think this behaviour (handle-read not returning on a closed connection) is caused by GHC so I'm not sure how we could fix this. |
Closing this PR since it's stale. |
I've made some improvements to the exception handling of the library:
error
when it's really not supposed to happen. This allows users of the library to deal with such situations, instead of just seeing some message in their logs.addConnectionClosedHandler
. If desired, a wrapper function can be added to preserve the old interface. But, in general one wants to know why a connection was closed, so changing the interface is justifiable to me.