-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Problem: HWM in ZMQ_DGRAM socket does not respect multipart message #3268
Comments
I tried a naive fix like this:
But now everything seems to hang when I hit the HWM, so I'm still digging, not sure what happens ... /EDIT: now it is blocking when we hit the HWM... |
dgram socket does not and will not support multipart messages |
Yes, true... bit isn't the interface something like this?:
found it here as well: https://github.com/zeromq/libzmq/blob/master/tests/test_dgram.cpp |
ah that's the address, never mind then |
aaah sorry, of course.. |
Aaah I see, I got confused because of a wrong return value... When hitting the HWM, then the errno was EINVAL... The reason is because the flag that indicates the multi-part state is handle wrong in the dgram... I'll provide a PR |
…ven if the send fails (#3270) * ZMQ_DGRAM: flip more flag after successful send In the dgram socket we have a flag that indicates the next expected message type to ensure that always a pair of "address" + "body" messages gets sent. The first one MUST have the sendmore flag, the second MUST NOT. In case the message does not get sent because of HWM full, then the function returns EAGAIN as it should. But unfortunately the next expected message type-flag gets flipped as well. When the socket_base::send function now tries to resend the message, it became the wrong message type... If you don't stop sending pairs of messages here (like me) then the next message that gets through will be of the wrong type, which in turn crashes the udp_engine function as described in #3268
Fixed by #3270 |
…ven if the send fails (zeromq#3270) * ZMQ_DGRAM: flip more flag after successful send In the dgram socket we have a flag that indicates the next expected message type to ensure that always a pair of "address" + "body" messages gets sent. The first one MUST have the sendmore flag, the second MUST NOT. In case the message does not get sent because of HWM full, then the function returns EAGAIN as it should. But unfortunately the next expected message type-flag gets flipped as well. When the socket_base::send function now tries to resend the message, it became the wrong message type... If you don't stop sending pairs of messages here (like me) then the next message that gets through will be of the wrong type, which in turn crashes the udp_engine function as described in zeromq#3268
Please use this template for reporting suspected bugs or requests for help.
Issue description
When sending a lot of messages over a ZMQ_DGRAM socket, I hit an assertion in:
Assertion failed: check () (/home/gabm/zeromq/src/msg.cpp:347)
.Environment
Minimal test code / Steps to reproduce the issue
What's the actual result? (include assertion message & call stack if applicable)
The callstack is:
So it happens in
udp_engine.cpp
at line 380. The rc value of the secondpull_msg
call is-1
.What's the expected result?
that it works 😄
Cause
Digging a bit deeper I found out that it happens when hitting the HWM. I started my program a very small HWM and it happens immediatly. The DGRAM socket interface requires two messages to be sent: the destination address and the body message. I think that one of these two gets discarded when hitting the HWM, the other survives. Then when processing the messages in the udp_engine, we cannot assume to get "both messages", because one might be dropped due to the HWM.
The text was updated successfully, but these errors were encountered: