mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #181] [CLOSED] Windows: the engine, vision encoder and MCP servers end with the server (closing the window no longer orphans them) #2495
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2495
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/181
Author: @Apposite245
Created: 9/30/2026
Status: ❌ Closed
Base:
main← Head:windows-kill-children-on-close📝 Commits (1)
0075ae8serve: on Windows the engine, vision encoder and MCP servers end with the server📊 Changes
4 files changed (+147 additions, -0 deletions)
View changed files
📝
serve/mcp.py(+3 -0)📝
serve/server.py(+3 -0)➕
serve/test_winjob.py(+67 -0)➕
serve/winjob.py(+74 -0)📄 Description
The startup text says close this window to stop the model, but on Windows closing the window leaves the model running. The console close ends Python without
atexitor the shutdown path, andstrata --serve,strata-visionand the MCP servers are plainPopenchildren with nothing tying them to the server, so they keep running and hold their VRAM and RAM until someone finds them in Task Manager. A crash or ending the server from Task Manager does the same. #153 fixes Ctrl+C; this covers every other way the server ends.Change
serve/winjob.py(new, stdlib ctypes only):contain(proc)puts a started child in a job object withJOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE. The job handle is created without an inheritable handle, so the server holds the only one, and the OS closes it however the server ends, which kills everything in the job. Processes a child starts later (e.g.npx, thennodefor an MCP server) join the job automatically.contain(self.proc)after eachPopen:StrataEngine.__init__(so also after an engine restart),Vision.__init__, andStdioTransport.startinserve/mcp.py.--openlaunches would be tied to the server and closed with it.containreturnsFalseand nothing changes. The existing shutdown path is untouched.Tested (Windows 11 25H2, Python 3.13.13)
serve/test_winjob.py: a stand-in server contains a child that starts a grandchild, then getsTerminateProcess'd (noatexit, nofinally, the same as closing the window). Both the child and the grandchild end. With theAssignProcessToJobObjectcall stubbed out, the test fails with "the child outlived the server". The test is skipped off Windows.python -m unittest serve.test_winjob serve.test_server serve.test_mcp serve.test_detokgives 68 run, OK (3 skipped by the suites themselves).run-<model>.batsession. I'll confirm on my next run and report back here.Independent of #153. It touches none of the same lines.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.