mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-16 03:49:26 +00:00
test(cpg-budget): a process vanishing mid-read is the success case too
Reading /proc/<pid>/stat for a process that is reaped during the read raises ProcessLookupError (ESRCH), not FileNotFoundError. The previous race fix caught only the latter, so the hanging-process-group test failed twice today under full-suite load. It passed alone. The disappearance is exactly what the test asserts. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
63460f8af4
commit
64ef488ce4
@@ -68,11 +68,12 @@ while True: time.sleep(1)
|
||||
status = Path(f"/proc/{pid}/stat")
|
||||
for _ in range(30):
|
||||
# Read, never check-then-read: a killed process can be reaped between the two, and its
|
||||
# disappearing is exactly the outcome this test wants, not an error.
|
||||
# disappearing is exactly the outcome this test wants, not an error. It can vanish before the
|
||||
# open (FileNotFoundError) or during the read, which the kernel reports as ESRCH.
|
||||
try:
|
||||
if status.read_text().split()[2] == "Z":
|
||||
break
|
||||
except FileNotFoundError:
|
||||
except (FileNotFoundError, ProcessLookupError):
|
||||
break
|
||||
time.sleep(0.005)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user