Repository navigation
fix(daemon): wait out Windows local teardown contention - #2599
Conversation
Signed-off-by: Pcristin <xxxokzxxx@protonmail.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
|
Thanks for the clear distinction between Windows teardown contention and native failure, and for linking the failing and passing regression runs. I have read the proposal and its validation notes; it remains pending maintainer review. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you, @pcristin -- this is a careful, well-argued fix. Telling "another client is starting right now" apart from a genuine native cleanup failure is exactly the right line to draw, and reusing the existing 120 s startup backstop keeps local teardown consistent with how acquisition already waits out a busy gate, instead of introducing a new budget. Keeping the boolean release API as a thin wrapper also left every other caller unchanged. The test-only baseline run that goes red on unchanged production code, next to the green run on this branch with the same regression section, made the change easy to verify. We pushed one commit on top of your branch so it can be merged against current main:
On our side, the daemon IPC suite passes on the merged tree, and a one-shot index plus six racing cold clients all exit 0 without a cleanup timeout on macOS (your try-release only reports contention on Windows, so the POSIX path behaves as before). Once the checks are green on the new head, this is ready to go in. Thanks again for tracking this down while working on #2305, and for the clear write-up. |
Fixes #2598.
Windows local teardown reacquires the startup-v2 gate and validated legacy mutex before releasing its participant claim. A busy gate currently shares the 500 ms cleanup deadline with native I/O failures. This can make a completed one-shot CLI command exit unsuccessfully while another client is starting.
This adds a nonblocking release result that distinguishes contention from native failure. Local cleanup retains its protection and waits for contention under the existing 120 s startup backstop. Repeated native failures still get the 500 ms deadline. The existing boolean release API remains available.
Tests cover both startup-v2 and legacy mutex contention, retained retry authority after native release failure, and a real supervised Windows indexing operation whose startup gate is held for more than 500 ms after indexing completes.
Verification
make -j3 -f Makefile.cbm securitypassed with LLVM 20 on Linux. The install stage was also rerun successfully without inheritedCODEX_HOME, so it used only its temporary home.section_local_cleanup_waits_for_startup_gatewith exit code 1 after a successful index response. The same run also fails cold-storm startup withcoordination.cleanup_timeout component=local_transition_cleanup. Its production code is unchanged from upstream.lint-ci, diff-scoped clang-tidy, source security audit, and the complete ASan/UBSan C suite (9,276 passed, 9 skipped). The test-only baseline had 9,275 passed, 9 skipped. The nine UBSan diagnostics match exactly between baseline and fix.daemon_ipchas 38 passed, 0 failed, 0 skipped, including startup-v2/legacy mutex contention and native-error retry coverage.ASAN_OPTIONS=detect_stack_use_after_return=0:quarantine_size_mb=16:thread_local_quarantine_size_kb=64on this 8 GiB Linux host with 4 GiB temporary swap. The full test suite remains enabled. The baseline reports nine existing UBSan diagnostics in callable-signature, documentation-link, and ObjectScript scanner code; these are outside this patch.This is a separate daemon bug found while checking #2305. The PR covers daemon cleanup and its regression tests.
AI assistance: written and tested with Codex on behalf of Pcristin. Pcristin has certified the DCO sign-off.