Skip to content

Commit 40d8294

Browse files
committed
fix(test): faithful _Exit in the harness index worker
The supervised-worker fast path deliberately skips the pipeline teardown (the OS reclaims the process wholesale) and pairs that with _Exit, which bypasses atexit/LeakSanitizer. The production worker in run_cli has both halves; the test binary's worker emulation (tf_maybe_run_index_worker) only had the first: it returned normally through main(), LeakSanitizer ran at exit, reported the intentionally unfreed pipeline and forced exit code 1 — so the supervisor read a healthy index as worker_failed and IDX832 went red on exactly the platforms whose ASan builds run a leak pass (all four Linux legs; macOS/Windows ASan have none). Reproduced and verified fixed in an ubuntu:22.04 arm64 container: reap outcome=clean, mcp suite 140/0. Mirror the production exit: deliver the response file, fflush, _Exit. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 1c1b6df commit 40d8294

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

tests/test_main.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,18 @@ static int tf_maybe_run_index_worker(int argc, char **argv) {
7575
(void)fclose(rf);
7676
}
7777
}
78-
free(result);
7978
}
80-
cbm_mcp_server_free(srv);
81-
return 0;
79+
/* Faithful worker exit: mirror run_cli's supervised-worker fast path.
80+
* The worker-role pipeline deliberately skips its teardown (the OS
81+
* reclaims everything wholesale on process death), so a normal return
82+
* through main() lets LeakSanitizer run at exit, report the
83+
* intentionally-unfreed pipeline, and force exit code 1 — the
84+
* supervisor then reads a HEALTHY index as worker_failed (the
85+
* Linux-only IDX832 red: LSan is active in Linux gcc ASan builds,
86+
* absent on macOS/Windows). _Exit skips atexit/LSan by design,
87+
* exactly like the production worker in run_cli. */
88+
fflush(NULL);
89+
_Exit(result ? 0 : 1);
8290
}
8391

8492
/* #798 follow-up: socket-isolation probe. The parent test

0 commit comments

Comments
 (0)