CI: DF crashes with 'free(): invalid pointer' at quit after test suite passes
The Linux gcc-11 test leg is intermittently failing with a heap-corruption crash at DF shutdown, after the test suite reports all tests passed. The subsequent DF launch in the same attempt then aborts at startup.
Observed on two unrelated branches:
- https://github.com/DFHack/dfhack/actions/runs/35271091388/job/105371147488 (suspendmanager-machine-collapse)
- https://github.com/DFHack/dfhack/actions/runs/35269070516 (add-tests, gcc-11 + gcc-12 + windows legs all failed in that run)
Tail of stderr.log from both runs is identical:
Tests completed in 10920 ms:
27/27 tests passed
185/185 checks passed
Invoking: lua scr.breakdown_level=df.interface_breakdown_types.QUIT
free(): invalid pointer
and on add-tests:
Tests completed in 17338 ms:
374/377 tests passed
5581/5583 checks passed
Invoking: lua scr.breakdown_level=df.interface_breakdown_types.QUIT
free(): invalid pointer
So the heap is already corrupted (or the teardown path frees a bad pointer) before DF exits; the test suite itself is green. Retries in the same attempt then fail earlier with Aborted (core dumped) right after dfhack: redirecting stderr to stderr.log, suggesting the first crash leaves the DF directory or process state in a way that breaks the follow-up launch.
This is separate from the Windows 60s-retry timeout that #5943 addresses, and it is currently masking otherwise-green runs.
As far as we can tell this is a DF bug. It's been doing this since the very first Linux builds of DF. We had to remove testing the exit status of DF because it always did this and we could never figure out why.
Thanks, good to know it is a longstanding DF-side bug. Closing since there is nothing actionable on the DFHack side. For anyone landing here from a red CI leg: if the log shows all tests passing and then free(): invalid pointer at quit, that is this issue, not the PR under test.