Repository navigation
Conversation
| """ | ||
| if self.process.poll() is not None: | ||
| # Cleanup zombie. | ||
| self.process.wait() |
There was a problem hiding this comment.
.wait() is not really needed here - if .poll() did not return None, it already did the wait on the child and got the returncode and returned it. poll() is just like using libc wait() with WNOHANG
|
A separate question which I'm not sure of, is if this is (Honestly not sure ... also btw I'm not the one who merges :) |
|
In my tests it didn't matter if it was inside or outside, so I put it outside for performance reasons. What mattered was breaking the infinite loop of whatever was calling recv(). |
|
@bitprophet Any chance I could get a merge on this? |
|
Mildly worried there might be situations where, somehow, |
|
IF you could rebase against 2.0 that'd be grand, btw! |
|
I've rebased this PR against master, and created a backport PR to the 2.0 branch: #995 |
c9430c5 to
76be849
Compare
|
@bitprophet Does new code still go into the 2.0 branch first before master? Based on more recent PRs, new changes seem to be going into master. |
|
From my observation, when the proxy command dies, |
If the proxy command dies during a read loop, we end up in a tight
loop that causes the process to max out a cpu until it's forcefully
killed.
In my experience, the easiest way to trigger this condition is to
use a proxy command and add some text to /etc/nologin on the
destination host (not the proxy host).
Another way to trigger this condition is to send a CTRL+C wile the
second command is running:
chan.exec_command('sleep 100')
stderr = chan.makefile_stderr('rb').read()
|
@vincentbernat I believe the updated patch should address your problem as well. Would you mind testing to confirm? |
|
I think it should work for most cases. It doesn't handle the EOF condition (subprocess still alive but read has been closed) and it looses the current buffer (a very uncommon edge case). See #1180 for a proposition handling the root cause. |
|
#1180 is a better implementation of this, closing. |
If the proxy command dies during a read loop, we end up in a tight
loop that causes the process to max out a cpu until it's forcefully
killed.
In my experience, the easiest way to trigger this condition is to
use a proxy command and add some text to /etc/nologin on the
destination host (not the proxy host).
Another way to trigger this condition is to send a CTRL+C wile the
second command is running:
chan.exec_command('sleep 100')
stderr = chan.makefile_stderr('rb').read()