Commit 9c68d7c
committed
Introduce keepalives for ZmqClient and ZmqServer
Fixes issue: sonic-net/sonic-buildimage#23110
When a DPU is powered off and back on, the ZMQ client on the switch still
holds a stale TCP connection. The first message sent after DPU restart is
delivered over the dead connection, gets a TCP RST, and is silently lost.
ZMQ then auto-reconnects, so subsequent messages succeed.
This patch enables:
1. TCP keepalive on ZmqClient PUSH sockets to detect dead connections
proactively (within ~8 seconds of peer going down).
2. ZMQ_IMMEDIATE on ZmqClient PUSH sockets to prevent queueing messages
to peers whose underlying TCP connection is not yet completed.
3. TCP keepalive on ZmqServer PULL sockets as defense-in-depth.
With these changes, after DPU power-off:
- TCP keepalive probes will fail, causing ZMQ to tear down the stale
connection and reconnect
- ZMQ_IMMEDIATE prevents the first message from being queued to a peer
with an incomplete connection, so it stays in the send queue until
the reconnection completes
Signed-off-by: Prabhat Aravind <[email protected]>1 parent 1e0584c commit 9c68d7c
2 files changed
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
112 | 136 | | |
113 | 137 | | |
114 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
93 | 107 | | |
94 | 108 | | |
95 | 109 | | |
| |||
0 commit comments