Commit e34fc1c
committed
Use a fixed deadline in the native connect timeout
awaitConnectComplete reset its time baseline (start = now) on every EINTR
and subtracted only whole milliseconds of elapsed time. Under a
high-frequency signal storm on the connecting thread -- e.g. a wall-clock
profiler or interval timer interrupting the blocked poll() more than once
per millisecond -- each interval truncated to 0 ms, so the budget never
decremented and poll() was re-armed with the full timeout every
iteration. The connect timeout could then extend well past its bound, or
never fire at all, contradicting the comment that EINTR storms cannot
extend it. Even at lower rates each interrupt discarded up to ~1 ms of
accounting, drifting the timeout one-directionally.
Compute one absolute monotonic deadline up front and derive the remaining
poll() budget from it each iteration. The remaining time can only
decrease, so the timeout is a strict upper bound regardless of interrupt
frequency; truncation now only under-shoots the final poll by < 1 ms,
which never extends the wait. The success, refused, and timeout paths are
otherwise unchanged.
Validated: NetConnectTimeoutTest (loopback success, refused-vs-timeout,
black-hole timeout within budget) passes against the rebuilt library. A
standalone harness driving the old vs new logic under a simulated 2.5 kHz
EINTR storm confirms the old logic runs unbounded (aborted at >10x the
budget) while the new logic returns at the budget. A deterministic
regression test at the JNI layer is not practical: Java cannot target a
POSIX signal at the specific connecting thread, and the only hanging-
connect fixture available (TEST-NET-1 black-hole) is routing-dependent
and already Assume-skipped on most runners.
Rebuilds the committed linux-x86-64 libquestdb.so from the net.c change
(mirrors the copy step in ci.yml); other platforms are refreshed by the
rebuild-native-libs workflow.1 parent da4bd1d commit e34fc1c
2 files changed
Lines changed: 31 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
310 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
311 | 325 | | |
312 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
313 | 339 | | |
314 | 340 | | |
315 | 341 | | |
316 | 342 | | |
317 | 343 | | |
318 | | - | |
319 | | - | |
| 344 | + | |
320 | 345 | | |
321 | 346 | | |
322 | 347 | | |
| |||
339 | 364 | | |
340 | 365 | | |
341 | 366 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
| 367 | + | |
| 368 | + | |
354 | 369 | | |
355 | 370 | | |
356 | 371 | | |
| |||
Binary file not shown.
0 commit comments