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
pika throws ChannelWrongStateError('Channel is closed.') on publish #1240
Comments
Hi, I had the same error, but not the exact situation. First I had I think it's confusing, since that the documentation says it will raise |
I'll be sure that the documentation is updated as well. |
I'm not exactly sure what scenario could cause I'll address this issue in this manner:
In another issue I will see how feasible it would be to have an |
Bump versions for win32 testing Fixes #1240
I've deleted my and other off-topic comments here. @SantjagoCorkez's point that the changes in 761ef5c may make it more difficult to distinguish between recoverarble vs non-recoverable errors is valid, and that's what I'm going to address, as well as documentation around the issue. |
I have the same issue |
Re-doing the exception hierarchy will have to wait until version 2.0 |
if you use basic publisher consumer code, the channel will eventually get closed when waiting for messages, even if you choose whatever parameters and heartbeat. and you reconnect each time you publish an event it's still the same. |
@Diaislam without code that I can run and instructions on how to reproduce what you describe, there's nothing I can do. If you'd like to investigate, open a new issue and help me help you. |
still happening to me even on pika==1.3.0
|
i am also getting this error.
any reason why ?? ` |
@activaigor @MahmudulHassan5809 neither of you have provided enough information for me to assist you
|
@lukebakken hello .. this the lgs i got from RabbitMQ . is it ok or i miss some things?
there was no network issue. and after few tries rabbitmq works fine like and then it again gives me channel closed or pika.exceptions.StreamLostError: Stream connection lost: ConnectionResetError(104, 'Connection reset by peer') |
@MahmudulHassan5809 - follow-up #1449 |
Is there any update here? In the connection pool with a heartbeat, connections are getting dropped as well. |
try this code :
initiate the variables in your class |
pika version: 1.1.0
As a result of interface link flapping a socket underneath pika's connection to RabbitMQ became dead. Since this state transition has not been properly processed by client code any subsequent
publish()
to pika'sChannel
then caused this:As a result:
a code like
would fail.
This behaviour was implemented at 761ef5c
But I disagree in total with the approach since it brakes the whole typed exception support of python itself. Typed exceptions are supported for the user of code can just quickly match the error yielded by runtime despite what's the actual reason. The commit mentioned brakes this and offers code users to revert to strings patterns matching. Instead of raising the same exception in cases:
opening
state but is not ready to operateone should provide a special type of an exception for each of the cases if the error recovery is supposed to differ, IMO.
For these two cases error recovery approaches obviously to me differ in total. For the channel in
opening
state it'swait a little then try again
(but don't reconnect since there's no reason for it); for the channel is in closed state it could berecover via reconnect
. Right now the code user differs what approach to use only with the Exception.args parsing.The text was updated successfully, but these errors were encountered: