mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-11 04:00:38 +00:00
fix(code-runtime-python): reset the inherited SIGXCPU disposition and mask at startup
The reviewer's standing issue: the child inherits the host's SIGXCPU disposition and signal mask — if the host ignores or blocks SIGXCPU, the soft RLIMIT_CPU fires but cannot stop the child, and the hard limit's SIGKILL then classifies a definite CPU overrun as worker-exit instead of a timeout. The bootstrap now resets SIGXCPU to SIG_DFL and unblocks it before any model code runs (the settle-time enforcer already restores SIG_DFL for a program that traps or masks the signal mid-run; this closes the inherited-state gap). The zh README's outer wire section also gains the truncation-exception sentence to match the en side.
This commit is contained in:
@@ -1195,6 +1195,17 @@ async def _run(channel: ProtocolChannel) -> None:
|
||||
# can `except ToolCallError as e:` and read the member property.
|
||||
namespaces[declared["name"]] = error_class
|
||||
|
||||
# The child inherits the host's SIGXCPU disposition and signal mask. If
|
||||
# the host ignores or blocks SIGXCPU, the soft RLIMIT_CPU fires but cannot
|
||||
# stop the child — the hard limit's SIGKILL then classifies a definite CPU
|
||||
# overrun as substrate death (worker-exit) instead of a timeout. Reset to
|
||||
# the default disposition and unblock before any model code runs (the
|
||||
# settle-time enforcer already restores SIG_DFL for a program that traps or
|
||||
# masks the signal mid-run; this closes the inherited-state gap).
|
||||
signal.signal(signal.SIGXCPU, signal.SIG_DFL)
|
||||
if getattr(signal, "pthread_sigmask", None) is not None:
|
||||
signal.pthread_sigmask(signal.SIG_UNBLOCK, (signal.SIGXCPU,))
|
||||
|
||||
channel.send_sync({"type": "boot-ack"})
|
||||
|
||||
# 3. Start a reply-pump task before the run message: replies can arrive
|
||||
|
||||
Reference in New Issue
Block a user