-
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
Blocked Connection Handler Not Triggered #104
Comments
The feature was contributed by a user so I actually never used it myself: #82 You can see from the discussion that the user also had some trouble actually getting the connection to be blocked, but was eventually successful. Unfortunately it's not clear how exactly he did that. So I do think the feature should work, but it's possible that in the meantime some changes were made that broke that code. My suggestion would be to try a different RabbitMQ client-library and see if it behaves differently. That would prove for certain that there's a bug in this library. |
I've managed to trigger the blocked state with the following program: {-# OPTIONS -XOverloadedStrings #-}
module TestBlocked where
import Network.AMQP
import Control.Monad (forM_)
import qualified Data.ByteString.Lazy.Char8 as BL
main = do
conn <- openConnection "127.0.0.1" "/" "guest" "guest"
chan <- openChannel conn
addConnectionBlockedHandler conn (\r ->
putStrLn "blocked"
) (
putStrLn "unblocked"
)
_ <- declareQueue chan newQueue {queueName = "myQueue"}
declareExchange chan newExchange {exchangeName = "myExchange", exchangeType = "direct"}
bindQueue chan "myQueue" "myExchange" "myKey"
forM_ [1..10000::Int] $ \ix -> do
publishMsg chan "myExchange" "myKey"
newMsg {msgBody = (BL.pack "hello world"),
msgDeliveryMode = Just Persistent}
closeConnection conn I executed You may have to run it multiple times, but eventually it should print "blocked" and then a bit later "unblocked". |
We are using the addConnectionBlockedHandler to log a message when rabbit when connections are blocked due to resource constraints but do not see any output when we see connections are clearly in a blocked state. To test this we artificially put rabbit into a resource constrained state:
rabbitmqctl set_vm_memory_high_watermark 0.000001
When this is done we see that there are connections that end up in a blocked state, however we do not see a message output to the logs. I'm wondering if you could provide some guidance on whether this is the correct way to test this and/ or if there is a known issue with this feature?
The text was updated successfully, but these errors were encountered: