Repository navigation
Conversation
55bfaff to
5179d71
Compare
|
You should still send SIGTERM first, and give it a couple of seconds to exit gracefully. |
|
(to clarify, the fix is the |
|
The latest changeset should do what you want. It's a bit more code than I wanted it to be, because it doesn't look like python has a proper function to handle a standard TERM/wait/KILL. |
| self.process.terminate() | ||
| while datetime.datetime.utcnow() < kill_after: | ||
| self.process.poll() | ||
| if self.process.returncode is not None: |
There was a problem hiding this comment.
this can be slightly consolidated into
if self.process.poll() is not None:(because .poll() returns returncode)
|
That is what I had in mind, thanks! |
|
Should be good now. |
|
👍 from me (the test failure appears to be a spurious pypy lockup in an unrelated test) |
|
@bitprophet Any chance I could get a merge on this? |
|
Rebase against 2.0 and I'll consider it! (same as the other PR :)) thanks! |
|
I've rebased this one against master, and created a backport for the 2.0 branch here: #996 |
|
Shouldn't need two PRs for this unless I'm missing something obvious; typically we merge to 2.0 and then just merge up to 2.1, 2.2, ..., master. |
|
Oh sorry, I'm just used to the master = mainline and everything is backported. I'll close the other one and move this to 2.0. |
After a proxy command exits, a defunct process will stick around until the calling process exits. This can accumulate to hundreds or thousands of processes if you are polling a remote server. The main problem is that wait() wasn't being called, however some extra logic was added to send a KILL if for some reason TERM doesn't end up doing it.
|
Hi, any plan of merging it into master and backport it to version 2? |
|
This is a pretty old PR, but in case anyone in the future sees this message, for my case (Win11, Python 3.12, Paramiko 3.5.0) the combination of this #962 and JulianEberius@bb1f795 Solved two issues:
Hopefully this gets merged to a future release |
After a proxy command exits, a defunct process will stick around
until the calling process exits. This can accumulate to hundreds
or thousands of processes if you are polling a remote server.
This simple fix will cleanup the zombie after it's killed.