Repository navigation
gix-filter: long-running process filters are never waited for (274 zombies in 10.5 h)
#2945
Closed
Tomasz Górka (tgorka)
started this conversation in
Feature Proposal
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi! I ran into a process leak in
gix-filterand have a small fix. I want to confirm before opening a PR.driver::State::shutdown()is the only code thatwait()s a long-runningprocessfilter, and nothing in the workspace calls it. Closing a child’s pipes makes it exit but doesn’t reap it, so on Unix every filter gitoxide launches keeps a process-table slot until the process exits.Clone for Stateresetsrunning, so each per-thread clone ingix-statusand in checkout abandons its own children.What it looks like in practice, in a desktop app with
filter.lfs.processregistered: 274 zombies after 10.5 h against akern.maxprocperuidof 2666, until nothing on the machine canfork()anymore. Also reproduced on Linux, where the child sits atstate=Zin/proc.The fix is ~30 lines of source: a
&mut selfform ofshutdownthat the by-value one delegates to, plusimpl Drop for State. Non-breaking, and it coversstatus,checkout,diff,mergeandworktree_streamat once. Details, evidence and tests are in two PRs on my fork — tests first, so the first one demonstrates the leak and the second flips it:process::Client::id()and pin theprocessfilter child lifecycle tgorka/gitoxide#1processfilter children instead of orphaning them tgorka/gitoxide#2Two questions before I open it here:
Dropthat blocks inwait()acceptable? The child’s stdin is closed first, which is what tells it to exit, so it returns promptly — but I’d understand a preference for an opt-out instead.Clone for Statekeep resettingrunning, or would you rather see one shared child pool? The current semantics are what multiply the leak.Happy to reshape this however suits you, or to drop it if you’d rather take a different route.
All reactions