Native thread exit delivery and cancellation causality, 2026-11-08
The custody tracer delayed real thread terminal waits behind unrelated fork
events. A native pthread fixture reproduces the resulting /proc disappearance
failure using Chromium's unchanged 30-iteration exponential sleep check. The
repair prioritizes final delivery after PTRACE_EVENT_EXIT, and consumes already
pending kernel fork messages before cancellation signals can replace them.
No Chrome, gameplay, remote runtime, or box was started for this investigation.
Chrome startup with the repaired tracer remains unvalidated; this is a native
causal repair, not a claim that the original Chrome deadline now passes.
Evidence: scratch/runs/20261108-native-thread-exit-causality-2038/. The exact
predecessor is Git 3021d134c, kernel SHA-256
e36d34990d738e616611ce8a8f4309548abcb751bd5ef5ec119d20e561c49360.
Recovery uses the recorded Git SHA and small relevant binary diff, with a patch
for this new note. Git remains the source archive. Fixture C files are small
run-specific inputs generated by the focused test; no media or module is copied.
Observed mechanism
Read-only examination of Q2's recovered custody and Chrome stderr confirms:
thread 7378/25787, TGID 7377, reached pre-exit-stop at
20:28:52.671620 UTC (sequence 559). Its actual terminal reap was not recorded
until 20:28:53.618146 (568), about 947 ms later. Between those records the tracer
serviced 7471's autoattach and 7430's clone attribution. Chrome 7377 reported
the 30-iteration thread-disappearance fatal at 20:28:54.116935; Crashpad's ptrace
permission failure followed. DevTools appeared after the unchanged startup cap.
The fatal does not identify its checked TID, so this timing establishes a
compatible delayed-delivery mechanism, not an exclusive historical root cause.
pthread_join can finish after the kernel clears the child TID futex while a
traced thread still exists in /proc/self/task. Its final tracer wait remains
necessary. waitid(P_ALL, ..., WNOWAIT|__WALL) does not promise to prioritize
that thread over competing tasks. Synchronous journal storage makes the delay
between selected statuses material. The repaired tracer remembers exit-stop
identities and probes their actual P_PID waits before unrelated work and command
output pumping. A nonblocking probe with no status falls through so other
threads can finish; ECHILD never counts as retirement. All normal identity,
durable before-wait logging, actual waitpid, and PID/start checks still apply.
The code retains the same ptrace options, per-record journal fsync, deadlines,
signals and escalation interval. No browser flags or backend are changed.
Native proof
The new focused fixture compiles a small C program with pthreads and real fork
children. A separate PID/start watchdog is observable and armed before the
supervisor's fork barrier; both roles have actual terminal waits. The pthread
program joins its worker and checks /proc/self/task/TID with exactly 30
exponential nanosleeps, without increasing that cap. An explicit scheduling shim
selects real competing kernel statuses for P_ALL, and injects 15 ms storage
latency after actual fsync. It fabricates no wait status, fork message, identity,
or terminal receipt. This is a controlled reproduction of a legal ordering,
not a claim to reproduce every detail of the remote scheduler or storage.
In the retained full-suite pair (exit-before-kifdbtng and
exit-fixed-kbe_q76m), the published predecessor delays the worker's final
receipt for 3.746 seconds: all 30 checks observe it and the program returns 42.
The repair records final delivery after 0.033 seconds, the check succeeds at
iteration 24, and the program returns zero. Both runs retain all 27 identities'
actual terminal receipts, EOF and finalized custody/command gzip streams.
complete: true in the failing predecessor means custody drained; its actual
nonzero root exit remains a failure. A delayed thread zombie can receive the
later group exit status; the test preserves the kernel's actual result instead
of substituting its earlier exit-stop message or expected worker return.
An additional C control releases eight pthreads together and joins them. All nine identities have actual terminal reaps, no remaining tasks, and complete custody. This checks that one pending final delivery cannot block other threads whose exit stops still need servicing.
Cancellation lineage
The second paired fixture exposes a real child's initial autoattach stop before its creator's real fork event and requests supervisor cancellation at that barrier. With the predecessor's signal-before-wait ordering, SIGKILL can replace the pending creator event. The child is actually reaped but lineage stays unresolved and drain correctly remains false. With the repair, the tracer probes only already owned tasks for actual pending fork/vfork/clone stops, consumes their real GETEVENTMSG attribution, and then sends cancellation signals. The fixed pair has two actual reaps, complete lineage and custody; supervisor cancellation still exits nonzero. No PPID inference or descendant scan is used.
This preserves available attribution, not information already destroyed by an
external fatal signal or a race after the last probe. Existing real SIGTERM and
SIGKILL fixtures that supersede clone attribution before observation still
report complete: false with explicit unresolved lineage. The PID-reuse, late
lineage, actual tracer/adoption double-wait, wrong-status, third-receipt,
WNOWAIT-zero, ESRCH, no-wait and no-pipe-EOF refusal controls remain passing.
Historical Q2 child 8107/30705 remains unresolved: sequence 951 registered its
autoattach stop with PPID 7201; 952 consumed it and 953 parked it. Sequence 1272
sent SIGKILL. Its real EXIT stop was consumed at 1307, irreversible retirement
at 1308 explicitly recorded lineageResolved: false, and 1311/1312 recorded the
actual adopted zombie and reap with status 9. There is no matching observed
parent fork event. Its later PPID 7188 and eventual absence establish neither
the missing attribution nor any additional wait. Q2's original 132 real reaps
and complete: false are unchanged. TR2's owned artifacts were not edited.
Validation and limits
python3 tools/native_kernel_custody_test.py: all 33 tests pass, including both
causal before/after pairs and the eight-thread control. The first development
run had two assertion failures: it incorrectly assumed a delayed worker's final
status must be zero and disallowed one competing event before its final status
became waitable. Those fixture artifacts are retained. Assertions now accept
the actual legal kernel status and permit that single nonblocking interleaving;
the failing predecessor still exhausts all 30 checks and the repair succeeds.
The locked flock /tmp/wine-build.lock bash tools/build.sh passed. Its result, original log
hashes/sizes, source identities and exhaustive regular-file inventory are in the
run receipts. Custody and command streams are gzip from their first stored byte;
the audit verifies CRC, original SHA-256/size and EOF against each drain receipt.
Symlinks are recorded without following them. Historical raw compatibility
tests use temporary directories; no raw command/custody stream is retained in
this task's evidence. Sampled /home free space exceeds 1,500,000,000 bytes.
No new box: ID none, state NOT_CREATED, expiry NULL, stop receipt not applicable. No old-box resume/delete, original retry, local Chrome, guest write, public deployment or subworker occurred. The next separately authorized startup validation must select the newly published kernel by hash, retain the same Chrome flags and caps, and continue to reject incomplete kernel lineage. Full Chrome startup and original gameplay remain open.