Skip to content
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

Mass-publishing messages results in QAbstractSocket::UnconnectedState #57

Open
J4nsen opened this issue Dec 7, 2016 · 5 comments
Open

Comments

@J4nsen
Copy link

J4nsen commented Dec 7, 2016

Hi,
I'm emitting a lot of JSON messages from a thread (QAmqpClient runs in the main thread). About 100k-500k in less than 10s. The first 50k messages are correctly received by the exchange. After that the connection to RabbitMQ gets disconnected:

[11:33:31] unknown: void QAmqpClientPrivate::sendFrame(const QAmqpFrame&) socket not connected: QAbstractSocket::UnconnectedState

Disabling confirms delays the problem a little bit, and waitForConfirms + enabling confirms results in a segmentation fault (Have not analyzed this further).

This is my class which publishes the messages: https://gist.github.com/J4nsen/40da0d436e4f8e00dbdbb5cc0860b20f

What is the best way to fix this problem? Implement a local queue/rate limiter and give the main thread some time for its main event loop? Or should I investigate in segfault with waitForConfirms?

Thanks,
Jan

@J4nsen
Copy link
Author

J4nsen commented Dec 7, 2016

The first error message is this one:

[15:22:12] unknown: <- basic#publish( exchange=direct_nodes, routing-key=node_63cf1623a636, mandatory=0, immediate=0 )
[15:22:12] unknown: <- basic#publish( exchange=direct_nodes, routing-key=node_823ec6a0e813, mandatory=0, immediate=0 )
[15:22:13] unknown: socket error: "Network operation timed out"
[15:22:13] unknown: exchange disconnected: "direct_nodes"
[15:22:13] unknown: void QAmqpClientPrivate::sendFrame(const QAmqpFrame&) socket not connected: QAbstractSocket::UnconnectedState
[15:22:13] unknown: void QAmqpClientPrivate::sendFrame(const QAmqpFrame&) socket not connected: QAbstractSocket::UnconnectedState
[15:22:13] unknown: <- basic#publish( exchange=direct_nodes, routing-key=node_63cf1623a636, mandatory=0, immediate=0 )
[15:22:13] unknown: void QAmqpClientPrivate::sendFrame(const QAmqpFrame&) socket not connected: QAbstractSocket::UnconnectedState

@mbroadst
Copy link
Owner

@J4nsen sounds like maybe rabbitmq is cutting off the connection, is there anything in the logs on the side of the equation?

@KonstantinZvyagin
Copy link

I got similar problem. When i send a lot of large messages RebbitMq drops connection.
Firs of all we have to look RabbitMq server log. It's look's like RabbitMq bug. Can You publish you log after you got error ?

@J4nsen
Copy link
Author

J4nsen commented Nov 8, 2017

Hey, sorry for not reporting back. I implemented the local queue/rate limiter which I talked about in my first post and didn't encounter the hang again :/. If I find the time, I will try to reproduce the original problem.

@manner82
Copy link

Hi,

I have also bumbed into this issue, and it is the client which is closing connection: rabbit logs:
client unexpectedly closed TCP connection

This workaround seems to be working:
client.setWriteTimeout(-2); // where client is the QAmqpClient.

Note: specifying -1 seems to mean "wait forever when sending a frame". Lower than -1 means, do not wait. Default seems to be 1000ms which seems to be not enough when mass publishing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants