fix(ci): windows test_c 8.5 — stop suite-abort on live-debugger hang + capture stack - #4066
fix(ci): windows test_c 8.5 — stop suite-abort on live-debugger hang + capture stack#4066Leiyks wants to merge 1 commit into
Conversation
… capture live-debugger hang stack [windows test_c]
|
Benchmarks [ tracer ]Benchmark execution time: 2026-07-27 14:24:05 Comparing candidate commit 4d242d5 in PR branch Found 0 performance improvements and 4 performance regressions! Performance is the same for 190 metrics, 0 unstable metrics.
|
What
windows test_c: [8.5]aborting the whole suite (~229/692 tests run) when atests/ext/live-debugger/test hangs in teardown.run-tests.phpas independent insurance.Why
Root cause of the secondary, suite-killing failure (fully diagnosed):
run-tests.phptimes it out and callsproc_terminate($proc, 9). On Windows this does not reliably kill the process tree, so the wedgedphp.exekeeps an OS lock on<test>.php.goto retryre-runs the test →save_text()→file_put_contents()on the locked file returnsfalse→error()→exit(1), fatally killing the run mid-suite.How
1. Teardown hang watchdog (
ext/hang_watchdog_windows.{c,h}, wired intoPHP_RSHUTDOWN_FUNCTION(datadog)inext/datadog.c):_DD_TEST_HANG_WATCHDOG_SECis set (set to40in the CI job, unset everywhere else → no-op in production). Arm-once per process.StackWalk64(dbghelp/psapi already linked inconfig.w32), writes it straight to the OS stdout handle (bypassing the CRT stdio lock the suspended thread may hold), thenTerminateProcess(self, 3).exit(1)cascade. Banner wording deliberately avoids run-tests' flaky-retry keywords..cis added toconfig.w32only; the header is astatic inlineno-op on non-Windows, sodatadog.cis unchanged elsewhere.2. run-tests.php hardening (
.gitlab/patch-run-tests-windows.php, invoked from thewindows test_cjob in.gitlab/generate-tracer.php):taskkill /T /Fthe timed-out process tree beforeproc_terminateso the file lock is released before the retry.save_text()write with a short backoff instead of aborting.Testing
patch-run-tests-windows.phpverified against realrun-tests.phpfor all 9 matrix versions (LF + CRLF) — applies on 8.2–8.5, tree-kill on 7.4+, byte-identical no-op on 7.2/7.3; all patched outputsphp -lclean.ext/datadog.ccompiles clean (-fsyntax-only, real PHP debug headers,-DDDTRACE); non-Windows header no-op compiles;generate-tracer.phplints and renders the job correctly.windows test_c: [8.5]— the primary verification. This run should (a) no longer abort the suite and (b) emit the hung thread's stack in the job log.Notes
windows test_cCI run.windows test_c: [8.5]log, then root-cause the ≥60s teardown hang itself. If the watchdog does NOT fire (still a silent 60s timeout), the hang is before RSHUTDOWN and the arm point should move earlier.