fix(envd): support opt-in descendant signals - #3617
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @tttboy123 on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check' |
1 similar comment
|
We require contributors to sign our Contributor License Agreement, and we don't have @tttboy123 on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check' |
|
We require contributors to sign our Contributor License Agreement, and we don't have @tttboy123 on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check' |
|
Follow-up hardening is pushed in During final review I found that The regression test now asserts both sides of that contract: a process that does not own its group remains alive and its output remains connected after the request is rejected. Fresh validation:
|
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
0a364e3 to
c95b0de
Compare
Problem
CommandHandle.kill()currently signals only the managed leader PID. Child processes can remain alive and are then correctly restored by a later memory-preserving pause/resume. I reproduced this against hosted E2B with Python SDK 2.46.4: the kill RPC returnedtruein 0.322s and removed the leader, while both child processes remained alive before and after pause/resume.This PR adds the envd/protocol half of an opt-in descendant-kill API while preserving the existing PID-only default. It relates to e2b-dev/E2B#1034.
Solution
descendants = 3boolean toSendSignalRequest(protobuf default:false).descendantsis false.The process-group scope intentionally covers descendants that stay in the command group. Descendants that call
setsid()can escape it; a per-command cgroup /cgroup.killguarantee would be a separate, larger lifecycle change.Compatibility
Existing clients omit
descendants, so their behavior is unchanged. A follow-up E2B SDK PR will expose this as an explicit Python/JS option after syncing this protocol commit.Validation
GOTOOLCHAIN=go1.26.6 go test -race ./...— passgolangci-lint v2.12.2 run --new-from-rev=upstream/main ./...— 0 issuesThe repository-wide unfiltered local lint currently also reports a pre-existing
unused-parameterwarning ininternal/services/process/dup3_other.go; CI usesonly-new-issues, and this PR introduces none.