ssh: reap exec transport children on disconnect by sairex53 · Pull Request #7439 · libgit2/libgit2 · GitHub
Skip to content

ssh: reap exec transport children on disconnect - #7439

Open
sairex53 wants to merge 1 commit into
libgit2:mainfrom
sairex53:fix-7437-ssh-child-reap
Open

sairex53 wants to merge 1 commit into
libgit2:mainfrom
sairex53:fix-7437-ssh-child-reap

Conversation

@sairex53

Copy link
Copy Markdown

Each SSH exec connection leaves a zombie child on Unix because closing the process pipes and freeing the process object never calls waitpid. Repeated fetches in a long-running client therefore accumulate unreaped SSH children.

Wait for the child after closing its pipes, retrying interrupted waits. The regression test uses a local fake SSH executable, connects and disconnects three times, and verifies that every child has already been reaped. It fails on the unmodified code and passes with this change.

Validation on Fedora AArch64: all 70 selected transport, clone-transport, and remote tests pass. No SSH server is needed.

Fixes #7437.

Closing the ssh process pipes and freeing git_process does not wait for
the child on Unix. Long-running clients accumulate a zombie after every
connection.

Wait for the child after closing the pipes, retrying interrupted waits.
Add a local fake-ssh regression test that connects and disconnects three
times and verifies that each child has already been reaped.

Fixes: libgit2#7437
Assisted-by: Codex:GPT-6
Signed-off-by: Eduard Zateev <hackerowskiy@gmail.com>

This branch has not been deployed

No deployments
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.

ssh_exec transport never reaps its ssh child: one zombie process per connection

1 participant