Harden `sig_prog()` retries, adjust debugger test timeouts
Retry signal delivery in `sig_prog()` up to `tries` times (default 3) w/ `canc_timeout` sleep between attempts; only fall back to `_KILL_SIGNAL` after all retries exhaust. Bump default timeout 0.1 -> 0.2. Also, - `test_multi_nested_subactors_error_through_nurseries` gives the first prompt iteration a 5s timeout even on linux bc the initial crash sequence can be slow to arrive at a `pdb` prompt (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codesubint_spawner_backend
parent
ccb013a615
commit
86d4e0d3ed
|
|
@ -199,15 +199,40 @@ def ci_env() -> bool:
|
||||||
def sig_prog(
|
def sig_prog(
|
||||||
proc: subprocess.Popen,
|
proc: subprocess.Popen,
|
||||||
sig: int,
|
sig: int,
|
||||||
canc_timeout: float = 0.1,
|
canc_timeout: float = 0.2,
|
||||||
|
tries: int = 3,
|
||||||
) -> int:
|
) -> int:
|
||||||
"Kill the actor-process with ``sig``."
|
'''
|
||||||
|
Kill the actor-process with `sig`.
|
||||||
|
|
||||||
|
Prefer to kill with the provided signal and
|
||||||
|
failing a `canc_timeout`, send a `SIKILL`-like
|
||||||
|
to ensure termination.
|
||||||
|
|
||||||
|
'''
|
||||||
|
for i in range(tries):
|
||||||
proc.send_signal(sig)
|
proc.send_signal(sig)
|
||||||
time.sleep(canc_timeout)
|
|
||||||
if not proc.poll():
|
if not proc.poll():
|
||||||
|
print(
|
||||||
|
f'WARNING, proc still alive after,\n'
|
||||||
|
f'canc_timeout={canc_timeout!r}\n'
|
||||||
|
f'sig={sig!r}\n'
|
||||||
|
f'\n'
|
||||||
|
f'{proc.args!r}\n'
|
||||||
|
)
|
||||||
|
time.sleep(canc_timeout)
|
||||||
|
else:
|
||||||
# TODO: why sometimes does SIGINT not work on teardown?
|
# TODO: why sometimes does SIGINT not work on teardown?
|
||||||
# seems to happen only when trace logging enabled?
|
# seems to happen only when trace logging enabled?
|
||||||
|
if not proc.poll():
|
||||||
|
breakpoint()
|
||||||
|
print(
|
||||||
|
f'XXX WARNING KILLING PROG WITH SIGINT XXX\n'
|
||||||
|
f'canc_timeout={canc_timeout!r}\n'
|
||||||
|
f'{proc.args!r}\n'
|
||||||
|
)
|
||||||
proc.send_signal(_KILL_SIGNAL)
|
proc.send_signal(_KILL_SIGNAL)
|
||||||
|
|
||||||
ret: int = proc.wait()
|
ret: int = proc.wait()
|
||||||
assert ret
|
assert ret
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -785,17 +785,28 @@ def test_multi_nested_subactors_error_through_nurseries(
|
||||||
|
|
||||||
# timed_out_early: bool = False
|
# timed_out_early: bool = False
|
||||||
|
|
||||||
for send_char in itertools.cycle(['c', 'q']):
|
for (
|
||||||
try:
|
i,
|
||||||
child.expect(
|
send_char,
|
||||||
PROMPT,
|
) in enumerate(itertools.cycle(['c', 'q'])):
|
||||||
timeout=(
|
|
||||||
6 if (
|
timeout: float = -1
|
||||||
|
if (
|
||||||
_non_linux
|
_non_linux
|
||||||
and
|
and
|
||||||
ci_env
|
ci_env
|
||||||
) else -1
|
):
|
||||||
),
|
timeout: float = 6
|
||||||
|
|
||||||
|
# XXX linux but the first crash sequence
|
||||||
|
# can take longer to arrive at a prompt.
|
||||||
|
elif i == 0:
|
||||||
|
timeout = 5
|
||||||
|
|
||||||
|
try:
|
||||||
|
child.expect(
|
||||||
|
PROMPT,
|
||||||
|
timeout=timeout,
|
||||||
)
|
)
|
||||||
child.sendline(send_char)
|
child.sendline(send_char)
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue