Repository navigation
execd: every command starts with default signal dispositions - #674
Merged
Merged
Conversation
A launcher that starts execd with `cmd &` or `nohup` leaves SIGINT, SIGQUIT and SIGHUP ignored, and an ignored disposition survives exec: every command and job inherited it, so a customer's Ctrl-C to a job did nothing and a shell could not trap it (E2B starts sandbox-exec that way, e2b.go:450). serve installs do-nothing handlers for HUP INT QUIT TERM USR1 USR2 ALRM before any spawn; exec resets a handler to the default, so every command starts with SIG_DFL. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LBGuEqmuH3r35k31s2EJ8X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A customer's SIGINT (Ctrl-C) to a job does nothing on E2B. Found by Beyond's W12.1 through the front: the verifier's
the signal op reaches a job's groupfailed there (the job's SIGINT trap never ran) while it passes on a direct execd. The verifier is right; this fixes the endpoint (supersedes the verifier change in #673, closed).Cause. Beyond's E2B provider starts sandbox-exec with
setsid nohup /usr/local/bin/sandbox-exec ... &inside a non-interactive shell (api/app/execfront/e2b.go:450in the beyond repo):&there sets SIGINT and SIGQUIT toSIG_IGN,nohupignores SIGHUP, and an ignored disposition survivesexec. Every command and job execd spawned inherited it, a shell could not eventrapit, and a signal to the job did nothing. (The execd binary happened to re-enable SIGINT becausemainwaits on it; an embedder such as sandbox-exec, and every other signal, did not.)Fix.
serveinstalls do-nothing handlers (tokio's safe signal driver) for HUP, INT, QUIT, TERM, USR1, USR2 and ALRM before any spawn (proc::release_signals).execresets a handler to the default, so every command, one-shot and job alike, starts with SIG_DFL. Side effect: execd itself survives a stray SIGHUP/SIGUSR1/SIGQUIT; it still stops on SIGTERM and SIGINT wheremainwaits for them.unsafestays forbidden (apre_execreset would need it).Test.
tests/signals.rsstarts execd the waycmd &/nohupdoes (those signals ignored in its own process) and shows a one-shot dying of each signal and a job'straprunning on each. Red without the fix (SIGQUIT ignored by a one-shot), green with it. The verifier's check is unchanged.Local, as ci.yml runs them: fmt, dprint, clippy (workspace and code-mode), audit, gateway-unit/e2e, agent-lib, code-mode, exec, jobs, rest, notify-e2e, workspace-rest, exec-live, sdk-ts, sdk-python all pass; agent-serve fails only 2
serve_service_managed_mcptests on this host (/proc/<pid>/memdenied).🤖 Generated with Claude Code
https://claude.ai/code/session_01LBGuEqmuH3r35k31s2EJ8X