Commit 1125b0b
Make close() rethrow gated on whether the user already saw the error
The previous gating ("close_flush_timeout_millis<=0 skips checkError") was
overly aggressive: setting timeout=0 to opt out of the drain wait should
not also swallow latched terminal errors. That made InitialConnectAsyncTest
fail (it relies on close() rethrowing as a safety net for the
"never-connected, async-initial-connect" case).
The opposite gate (always rethrow on close) breaks ACL tests where a
producer thread already caught the error synchronously via flush()
or via a registered async error handler -- close()'s rethrow then
escapes through try-with-resources and masks the in-flight test
assertion.
Reconcile both: rethrow on close() only when neither channel has
delivered the error to the user yet. Track two flags --
errorSurfacedSynchronously on CursorWebSocketSendLoop (set inside
checkError() the first time it actually throws) and
deliveredToCustomHandler on SenderErrorDispatcher (set when the
dispatcher invokes a non-default handler). close() consults both: if
either is true, the user has already seen the error and the rethrow
would only mask cleanup-path exceptions; if both are false, close()
rethrows as the only loud signal. The default no-op logging handler
does not count as "seen by user", so a config-string-only caller still
gets the rethrow.
Update assertCloseRethrowsTerminal in InitialConnectAsyncTest to
tolerate the no-rethrow path (the inbox observation earlier in the test
already pins the primary contract); when close() does throw, the message
must still match.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 12fc150 commit 1125b0b
4 files changed
Lines changed: 81 additions & 13 deletions
File tree
- core/src
- main/java/io/questdb/client/cutlass/qwp/client
- sf/cursor
- test/java/io/questdb/client/test/cutlass/qwp/client
Lines changed: 24 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
767 | 767 | | |
768 | 768 | | |
769 | 769 | | |
770 | | - | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
771 | 791 | | |
772 | 792 | | |
773 | 793 | | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | | - | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
778 | 797 | | |
779 | | - | |
780 | 798 | | |
781 | 799 | | |
782 | 800 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
185 | 193 | | |
186 | 194 | | |
187 | 195 | | |
| |||
308 | 316 | | |
309 | 317 | | |
310 | 318 | | |
| 319 | + | |
311 | 320 | | |
312 | 321 | | |
313 | 322 | | |
314 | 323 | | |
315 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
316 | 337 | | |
317 | 338 | | |
318 | 339 | | |
| |||
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
77 | 84 | | |
78 | 85 | | |
79 | 86 | | |
| |||
177 | 184 | | |
178 | 185 | | |
179 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
180 | 199 | | |
181 | 200 | | |
182 | 201 | | |
| |||
234 | 253 | | |
235 | 254 | | |
236 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
237 | 260 | | |
238 | | - | |
| 261 | + | |
239 | 262 | | |
240 | 263 | | |
241 | 264 | | |
| |||
Lines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
343 | 350 | | |
344 | 351 | | |
345 | 352 | | |
346 | 353 | | |
347 | | - | |
348 | 354 | | |
349 | 355 | | |
350 | 356 | | |
| |||
0 commit comments