If you monitor the connection settings and immediately send data when connecting, then in most cases the data does not reach the recipient, despite the fact that the zmq_socket_monitor method generates the ZMQ_EVENT_CONNECTED event.
If, after receiving the ZMQ_EVENT_CONNECTED event, you wait at least 1 millisecond, then data reaches the recipient.
From the sender’s side, it doesn’t matter whether the “BUG to fixed” line is commented out or uncommented
zmq_version 4.3.6
Got connection from tcp://127.0.0.1:9210 1:15
Send[2]
On the recipient side listening to the SUB socket, the data usually does not reach the recipient if the “BUG to fixed” line is commented out, but sometimes (extremely rarely) the data does reach.
One gets the feeling that somewhere inside ZMQ there is a race condition, while the monitor issues the ZMQ_EVENT_CONNECTED event, but the socket itself is not yet in the connected state.
What's the expected result
Data should always be transferred and there should be no race conditions. Otherwise, it is not clear how to control the CONNECT event from the publisher side and why is “zmq_socket_monitor” needed at all if it cannot be trusted.
Issue description
If you monitor the connection settings and immediately send data when connecting, then in most cases the data does not reach the recipient, despite the fact that the zmq_socket_monitor method generates the ZMQ_EVENT_CONNECTED event.
If, after receiving the ZMQ_EVENT_CONNECTED event, you wait at least 1 millisecond, then data reaches the recipient.
Environment
Minimal test code / Steps to reproduce the issue
What's the actual result
One gets the feeling that somewhere inside ZMQ there is a race condition, while the monitor issues the ZMQ_EVENT_CONNECTED event, but the socket itself is not yet in the connected state.
What's the expected result
Data should always be transferred and there should be no race conditions. Otherwise, it is not clear how to control the CONNECT event from the publisher side and why is “zmq_socket_monitor” needed at all if it cannot be trusted.