Comments (7)
Hi,
adding a function that's called for channel exceptions sounds like a good idea. But I'm not sure it makes sense to have another function for non-exceptional channel closes. AFAIK the only way a channel could be non-exceptionally closed is when the user calls closeChannel
, in which case the user already knows the channel is about to be closed.
from amqp.
Sounds perfectly reasonable to me!
In case I might be able to carve some time this week and issue a PR, would you be keen on reviewing and eventually merging it?
Thanks for the blazing-fast reply ;)
from amqp.
Yes, I'd review and most probably merge it.
from amqp.
Now that #53 has been merged, any chance for 0.12 to hit Hackage today? 😉
from amqp.
Pushed it to Hackage. I initially wanted to also remove that catch
in the channelReceiver but that seems to be a bit trickier than I expected.
Thank you for your contribution! Let's hope we didn't break anything.
from amqp.
Ha! Thank you very much! I am going to give a package a go next week, so if we did I will report back :)
from amqp.
As a small success story, our patch seems to work, at least superficially. This is what I get from the logs inside my development environment, when the server is running but I kill the broker abruptly:
"New job = ...
"New job = ...
Rebooting the server due to 127.0.0.1:5672: Network.Connection.connectionGet: end of file
Rebooting the server due to 127.0.0.1:5672: Network.Connection.connectionGet: end of file
Rebooting the server due to 127.0.0.1:5672: Network.Connection.connectionGet: end of file
Rebooting the server due to 127.0.0.1:5672: Network.Connection.connectionGet: end of file
Rebooting the server due to 127.0.0.1:5672: Network.Connection.connectionGet: end of file
Rebooting the server due to 127.0.0.1:5672: Network.Connection.connectionGet: end of file
Rebooting the server due to 127.0.0.1:5672: Network.Connection.connectionGet: end of file
Rebooting the server due to 127.0.0.1:5672: Network.Connection.connectionGet: end of file
the message that you see, is triggered by this simple helper function:
-- We explicitly filter out the two cases where a channel can be closed gracefully;
-- 1. When it received a ThreadKilled exception
-- 2. When a user is shutting it down as part of the normal connection closing routine.
reactToChannelException :: SomeException -> IO ()
reactToChannelException (asyncExceptionFromException -> Just ThreadKilled) = return ()
reactToChannelException (fromException -> Just (ConnectionClosedException "closed by user")) = return ()
reactToChannelException ex = do
yellow $ T.pack $ "Rebooting the server due to " <> show ex
rebootServer
(I'm using the ViewPattern extension to make everything a bit more slick).
More testing is certainly needed, but this looks to me like a promising start :)
from amqp.
Related Issues (20)
- Delivery timeout does not close channel HOT 2
- Using a green thread per message consume HOT 2
- `closeConnection` can swallow IO exceptions and block / hang indefinitely HOT 5
- Blocked Connection Handler Not Triggered HOT 2
- Example showing exception handling and reconnects HOT 2
- x-stream-offset is 64bit unsigned HOT 2
- (removed)
- Support Consumer Cancellation Notification HOT 10
- Add From/ToFieldValue classes HOT 10
- Why is publishing on the same channel thread while consuming a problem? HOT 4
- openConnection/closeConnection not thread safe HOT 1
- No Channel.Close_ok sent when channel is closed from server HOT 2
- Deadlock on calling cancelConsumer. HOT 11
- "decodeUtf8: Invalid UTF-8 stream" when accessing non-UTF8 header data HOT 5
- consumeMessages hangs when committing transaction HOT 5
- Design: Exception handling (swallowing?) in subscriber callback. HOT 7
- Add withConnection function HOT 4
- Dangerous uses of forkIO HOT 19
- closeChannel results in an unhandled exception message HOT 1
- Does aknowledging the message kills handler thread? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amqp.