mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5514] Extension sandbox watchdog kills healthy extensions after a process-wide freeze (no resume grace) #3065
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#3065
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Aug 25, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5514
Originally assigned to: @kolacheee on GitHub.
Found while auditing #5506 (does not affect Termux — server extensions cannot run there since bubblewrap is unavailable; this is a desktop Linux/macOS issue).
The server-extension sandbox watchdog judges staleness by wall-clock delta: every 1s it compares
Date.now() - lastHeartbeat(heartbeat-file mtime) againstSANDBOX_HEARTBEAT_STALE_MS= 25s (packages/server/src/services/extensions/personal-server-extension-runtime.ts:372-401,sandbox-protocol.ts:40on staging). When the OS suspends/freezes the whole process group for more than ~25s (laptop lid close, cgroup freezer, container pause, sleep), the host and the sandboxed child resume together — but the host's first watchdog tick races the child's first post-resume heartbeat write. If the host wins the race, it SIGKILLs a perfectly healthy extension, sets the status to "Server extension was stopped because its sandbox became unresponsive", and never auto-restarts it, so the extension stays dead until a manual reload.The teardown itself is crash-safe (#4727 hardening verified) — the defect is only the false-positive kill.
Fix shape: give the watchdog a resume grace — track the watchdog's own last tick time, and when
now - lastTickvastly exceeds the 1s cadence (i.e., the whole process was frozen), resetlastHeartbeat = nowbefore judging staleness, so the child gets one full stale-window after any freeze.@SpicyMarinara commented on GitHub (Aug 25, 2026):
@kolacheee I am taking the minimal implementation into one release-hardening PR against staging now, using the fix boundaries from your audit. I will keep your diagnosis credited in the PR and avoid expanding scope beyond the four verified paths.