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(
|
||||
proc: subprocess.Popen,
|
||||
sig: int,
|
||||
canc_timeout: float = 0.1,
|
||||
canc_timeout: float = 0.2,
|
||||
tries: int = 3,
|
||||
) -> int:
|
||||
"Kill the actor-process with ``sig``."
|
||||
proc.send_signal(sig)
|
||||
time.sleep(canc_timeout)
|
||||
if not proc.poll():
|
||||
'''
|
||||
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)
|
||||
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?
|
||||
# seems to happen only when trace logging enabled?
|
||||
proc.send_signal(_KILL_SIGNAL)
|
||||
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)
|
||||
|
||||
ret: int = proc.wait()
|
||||
assert ret
|
||||
|
||||
|
|
|
|||
|
|
@ -785,17 +785,28 @@ def test_multi_nested_subactors_error_through_nurseries(
|
|||
|
||||
# timed_out_early: bool = False
|
||||
|
||||
for send_char in itertools.cycle(['c', 'q']):
|
||||
for (
|
||||
i,
|
||||
send_char,
|
||||
) in enumerate(itertools.cycle(['c', 'q'])):
|
||||
|
||||
timeout: float = -1
|
||||
if (
|
||||
_non_linux
|
||||
and
|
||||
ci_env
|
||||
):
|
||||
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=(
|
||||
6 if (
|
||||
_non_linux
|
||||
and
|
||||
ci_env
|
||||
) else -1
|
||||
),
|
||||
timeout=timeout,
|
||||
)
|
||||
child.sendline(send_char)
|
||||
time.sleep(0.01)
|
||||
|
|
|
|||
Loading…
Reference in New Issue