Converting COMMIT_MODE_WAIT away from a blocking wait removed the only mechanism that ever detected a commit timing out (the caller's own pthread_cond_timedwait deadline). Adds a dedicated per-commit-engine sweep thread that arms an equivalent timeout for async-registered continuations, resolving FAILED/-ETIMEDOUT within the same DEFAULT_SYNC_TIMEOUT_MS window the old blocking path used, with no thread parked to detect it. Chose a private sweep thread over the shared delaymgr: wiring delaymgr would touch cluster.c/ha.c (out of boundary) and its 200ms poll granularity vs the 500ms default timeout would add jitter, breaking the "identical failure timing" no-regression bar. Round 1 review rejected a lost-wakeup race: the sweep loop computed its next-deadline snapshot under lock, unlocked to dispatch, then slept on the stale snapshot -- a registration landing mid-dispatch had its broadcast lost (no thread parked on the condvar), so the sweep thread could sleep on an absent/late deadline indefinitely. Fixed by holding the lock continuously across scan-then-wait decisions and always re-scanning immediately before ever waiting (recheck-then-wait idiom). Round 2 review independently reproduced the round-1 bug shape against the fix to confirm it actually closes the race, not just narrows it. |
||
|---|---|---|
| .. | ||
| settings | ||
| specs | ||
| steering | ||