oficina / equipo Public

containment test: a pid part way through its reap is not an error

TestNamespaceRecoveryCrashBeforeExit failed once on hosted CI with
"invalid argument". pidfd_open returns EINVAL, not ESRCH, while the
kernel has unhashed the process and not yet freed its number. The test
polled for ESRCH and failed on anything else; it now keeps polling
through EINVAL. exactPID in recovery.go treats only ESRCH as gone, so a
recovery that lands in the same window reports an error; not changed
here.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 5570e5a5a4a31697913ea5b0b23d9ed62b82cf96 parent 6ba2126
1 file changed, +7 −3
  • internal/runner/containment/recovery_test.go +7 −3
diff --git a/internal/runner/containment/recovery_test.go b/internal/runner/containment/recovery_test.go
index 3e8adb5e..38a172f7 100644
--- a/internal/runner/containment/recovery_test.go
+++ b/internal/runner/containment/recovery_test.go
@@ -433,12 +433,16 @@ func TestNamespaceRecoveryCrashBeforeExit(t *testing.T) {
if err == unix.ESRCH {
break
}
- if err != nil {
+ // EINVAL is the kernel part way through the reap: the process is
+ // unhashed and its number not yet free. Soon it is ESRCH.
+ if err != nil && err != unix.EINVAL {
t.Fatal(err)
}
- unix.Close(probe)
+ if err == nil {
+ unix.Close(probe)
+ }
if time.Now().After(deadline) {
- t.Fatal("namespace init was not reaped")
+ t.Fatalf("namespace init was not reaped: %v", err)
}
time.Sleep(time.Millisecond)
}