Commit 862ff31
Harden driver IPC and registry client robustness (#33)
driver/ipc.go: drop late IPC replies after timeout instead of
mis-correlating them with the next request. Each sendAndWait now
registers a private, single-use waiter slot; readLoop delivers only to
the active waiter and only when the reply cmd matches (cmdError always
allowed). On timeout/disconnect the slot is abandoned, so a reply for an
already-timed-out request finds no matching waiter and is dropped rather
than handed to an unrelated caller. Full cross-process correctness still
needs daemon-side request IDs (coordinated change + version bump),
documented as a TODO.
driver/driver.go: DialAddr now applies a 30s default timeout via
DialAddrTimeout so a non-responsive daemon can't block forever; Listen
and Broadcast get the same bound. jsonRPC paths (incl. WaitForTrust,
which blocks in the daemon by design) keep the unbounded path. Document
SendTo as fire-and-forget (nil means local IPC enqueue, not delivery).
driver/conn.go: serialize Read with a dedicated mutex so recvBuf can't
be corrupted by concurrent readers; implement SetWriteDeadline (was a
silent no-op) backed by a writeDeadline checked in Write; SetDeadline
now sets both read and write deadlines; document Write success as local
IPC enqueue, not remote delivery.
registry/client/client.go: bound every initial TCP/TLS dial with a 5s
timeout (matching the reconnect paths) so registry ops can't hang on an
unreachable host.
Tests: add TestLateReplyAfterTimeoutNotMisdelivered (verified to fail
without the waiter cmd-match guard) and a real SetWriteDeadline behavior
test; update fixtures for the removed shared pending buffer.
Co-authored-by: Teodor Calin <teodor@vulturelabs.io>1 parent 542658f commit 862ff31
8 files changed
Lines changed: 365 additions & 82 deletions
File tree
- driver
- registry/client
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
28 | 36 | | |
29 | | - | |
30 | | - | |
31 | 37 | | |
32 | | - | |
33 | | - | |
34 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
35 | 48 | | |
36 | 49 | | |
37 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
38 | 54 | | |
39 | 55 | | |
40 | 56 | | |
| |||
78 | 94 | | |
79 | 95 | | |
80 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
81 | 106 | | |
82 | 107 | | |
83 | 108 | | |
84 | 109 | | |
85 | 110 | | |
86 | 111 | | |
| 112 | + | |
87 | 113 | | |
88 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
89 | 119 | | |
90 | 120 | | |
91 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
92 | 127 | | |
93 | 128 | | |
94 | 129 | | |
| |||
125 | 160 | | |
126 | 161 | | |
127 | 162 | | |
128 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
129 | 172 | | |
130 | 173 | | |
131 | 174 | | |
| |||
141 | 184 | | |
142 | 185 | | |
143 | 186 | | |
144 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
145 | 199 | | |
146 | 200 | | |
147 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
30 | 38 | | |
31 | 39 | | |
32 | 40 | | |
| |||
83 | 91 | | |
84 | 92 | | |
85 | 93 | | |
86 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
87 | 97 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 98 | + | |
112 | 99 | | |
113 | 100 | | |
114 | 101 | | |
| |||
146 | 133 | | |
147 | 134 | | |
148 | 135 | | |
149 | | - | |
| 136 | + | |
150 | 137 | | |
151 | 138 | | |
152 | 139 | | |
| |||
167 | 154 | | |
168 | 155 | | |
169 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
170 | 164 | | |
171 | 165 | | |
172 | 166 | | |
| |||
192 | 186 | | |
193 | 187 | | |
194 | 188 | | |
195 | | - | |
| 189 | + | |
196 | 190 | | |
197 | 191 | | |
198 | 192 | | |
| |||
0 commit comments