Repository navigation
cell 0.1.5 — the server stops leaking a handle per request
Highlights
- The server no longer leaks a handle per request.
cell --servegrew one
Win32 handle for every HTTP request on the MinGW/winpthreads build — the one
the desktop shell launches — becausestd::thread::detach()never closes the
underlying thread handle there, and the accept loop ran every connection on a
detached thread. Measured before the fix: 600 requests → +600 handles, a
monotone climb for as long as the GUI keeps polling. Connection threads now
stay joinable and finished ones are reaped, so 400 requests leave the count
unchanged. - The same leak sat in the per-turn output capture.
serve::capture
detached its stdout/stderr reader once per agent turn (~+2 handles per turn,
measured), and the class was not RAII: a turn that threw betweenbegin()and
end()left fd 1/2 pointing at the capture pipe for the rest of the process —
three leaked descriptors, a blocked thread and stdout itself. The reader is
now a joinable member thatend()joins, so a destructor restores the
streams, joins and closes: 30 turns and 6 cancelled turns now leave the handle
count flat.
Fixes
http_server: connection threads stay joinable and finished ones are reaped
(afinishedflag plusreap_connections()before each accept);stop()
waits a bounded 5 s for in-flight connections and only detaches what is still
running;~http_server()callsstop(), so a joinable member can never turn
intostd::terminate; the tracking vector is grown before the thread exists,
because a throwingpush_backwould destroy a joinablestd::thread.serve_connection: asocket_guardowns the socket for the whole call, so
the early returns and a throwing parse no longer skip the close.serve::capture: RAII as described above, and thedup2failure path no
longer callsfd_dup2()with an already-closed descriptor.tests/e2e_serve.py: a handle gate — 60 sequential requests must not grow the
kernel's handle count by more than 15. Verified red against the pre-fix binary
(197 → 257, on all three attempts) and green after it (160 → 160). It is
Windows-only on purpose (POSIX reclaims a detached thread together with the
thread itself) and says so instead of passing silently elsewhere.
Docs
README_zh.md: a full Chinese translation of the README, section for section,
with the internal anchors recomputed for the Chinese headings.- Both READMEs now open with a language switch (English ⇄ 简体中文).
Packages
| platform | file |
|---|---|
| Windows x64 (MSVC, static) | cell-v0.1.5-windows-x64-msvc.zip |
| Linux x64 (GCC 14) | cell-v0.1.5-linux-x64-gcc14.tar.gz |
| macOS arm64 (AppleClang) | cell-v0.1.5-macos-arm64-appleclang.tar.gz |
Each package contains cell (CLI) and cellui (desktop shell), README.md,
LICENSE and the brand/ assets.