Skip to content

python-codecs: reap frame forks whose event loop or handoff hangs - #2211

Merged
koush merged 1 commit into
koush:mainfrom
SVilgelm:python-codecs/fork-leak
Nov 9, 2026
Merged

koush merged 1 commit into
koush:mainfrom
SVilgelm:python-codecs/fork-leak

Conversation

@SVilgelm

@SVilgelm SVilgelm commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Idle frame forks pile up in python-codecs (at about 65 MB each) and stay until the daily restart. There are two ways a fork outlives its session. Its watchdog is a loop.call_later timer, so if the fork's event loop wedges (#2210 is one way that happens) the timer never fires. And if the parent hangs awaiting fork.result or the generateVideoFrames* call, the fork's watchdog is never armed, and nothing terminates it because terminate_zygote only runs on an exception. The watchdog now runs on its own thread off a last-activity timestamp, with the same 10 second limit and the same arming points, and the parent bounds both handoff awaits with a 30 second timeout so a hang terminates the fork like any other failure.

Copilot AI balanced review requested due to automatic review settings November 9, 2026 07:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

The frame watchdog was an event loop timer, so a fork whose loop wedged never exited, and a fork that hung before generateVideoFrames* ran had no watchdog at all.

Assisted-by: Claude Opus 5.5
Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>
@SVilgelm
SVilgelm force-pushed the python-codecs/fork-leak branch from 959e19c to bbe9f0f Compare November 9, 2026 07:34
@koush
koush merged commit 8f51672 into koush:main Nov 9, 2026
@SVilgelm
SVilgelm deleted the python-codecs/fork-leak branch November 9, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants