You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified that the ZMTP 3.1 heartbeat protocol works great with PUB/SUB sockets. However, when I tried to turn it on for a REQ/REP pair, I encountered immediate failures on the REQ-socket side.
Looking at traffic with wireshark shows that after the first cycle of PING/PONG packets, the REQ socket sends a TCP FIN, and then silently fails to send any further data or attempt to reconnect. This behavior occurs regardless of whether the heartbeating is enabled on the REQ side or REP side, or whether timeouts/ttl are enabled or disabled.
Environment
libzmq version (commit hash if unreleased): 4.2.3
I tested using pyzmq 17.0.0 to keep the code simple, but TCP errors sure seem like an issue in the underlying libzmq.
Running both simultaneously results in the disconnects described below.
The results are the same if the heartbeating is turned on on the server-side instead, with:
s.HEARTBEAT_IVL=5000s.HEARTBEAT_TTL=50000
(Here setting the TTL instead of the TIMEOUT, for symmetry.)
If neither TIMEOUT nor TTL are set, the ping/pong protocol should be enabled, but there should be no disconnections on missed heartbeats. Even in this case, however, the REQ socket still disconnects after the first ping/pong.
What's the actual result?
The client can properly send and receive for 5 seconds (or whatever the heartbeat interval is set to). As soon as a heartbeat packet is sent and received (or received and sent, if it originated on the server), I observe that the client sends a TCP FIN. Subsequent sends will "succeed" on the client side, but no actual data will be sent. (This was tested with wireshark capturing all communication on the loopback interface to/from TCP port 5555.)
What's the expected result?
The expected result is that the REQ socket will continue to send heartbeats and if a disconnect is detected, try to reconnect.
For example, the following works just fine with a PUB/SUB pair.
Issue description
I have verified that the ZMTP 3.1 heartbeat protocol works great with PUB/SUB sockets. However, when I tried to turn it on for a REQ/REP pair, I encountered immediate failures on the REQ-socket side.
Looking at traffic with wireshark shows that after the first cycle of PING/PONG packets, the REQ socket sends a TCP FIN, and then silently fails to send any further data or attempt to reconnect. This behavior occurs regardless of whether the heartbeating is enabled on the REQ side or REP side, or whether timeouts/ttl are enabled or disabled.
Environment
Minimal test code
Here's an "echo server" script:
And the matching REQ "client":
Running both simultaneously results in the disconnects described below.
The results are the same if the heartbeating is turned on on the server-side instead, with:
(Here setting the TTL instead of the TIMEOUT, for symmetry.)
If neither TIMEOUT nor TTL are set, the ping/pong protocol should be enabled, but there should be no disconnections on missed heartbeats. Even in this case, however, the REQ socket still disconnects after the first ping/pong.
What's the actual result?
The client can properly send and receive for 5 seconds (or whatever the heartbeat interval is set to). As soon as a heartbeat packet is sent and received (or received and sent, if it originated on the server), I observe that the client sends a TCP FIN. Subsequent sends will "succeed" on the client side, but no actual data will be sent. (This was tested with wireshark capturing all communication on the loopback interface to/from TCP port 5555.)
What's the expected result?
The expected result is that the REQ socket will continue to send heartbeats and if a disconnect is detected, try to reconnect.
For example, the following works just fine with a PUB/SUB pair.
"Server":
"Client":
The text was updated successfully, but these errors were encountered: