Merge lp:~maxb/bzr/2.2-close-ssh-subprocess-socket into lp:bzr/2.2
Proposed by
Max Bowsher
Status: | Merged |
---|---|
Approved by: | Andrew Bennetts |
Approved revision: | no longer in the source branch. |
Merged at revision: | 5110 |
Proposed branch: | lp:~maxb/bzr/2.2-close-ssh-subprocess-socket |
Merge into: | lp:bzr/2.2 |
Diff against target: |
91 lines (+21/-18) 2 files modified
NEWS (+3/-0) bzrlib/transport/ssh.py (+18/-18) |
To merge this branch: | bzr merge lp:~maxb/bzr/2.2-close-ssh-subprocess-socket |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
John A Meinel | Approve | ||
Andrew Bennetts | Approve | ||
Review via email: mp+40493@code.launchpad.net |
Commit message
Close leaked socket to SSH subprocesses
Description of the change
This change fixes a bug introduced in 2.2b4 when bzr was made to use a socketpair to talk to ssh subprocesses if supported on the platform. The resultant socket was never actually closed - I've not observed this breaking anything in bzr, but it causes dput sftp uploads (which use bzrlib) to hang on completion.
To post a comment you must log in.
The code looks reasonable. I wonder if to be pedantically correct we should also be attempting to close the other side of the socketpair too, in case the subprocess doesn't close it for us? That would mean SubprocessVendo r._connect should subproc_sock into SSHSubprocessCo nnection so it can pass it along to your improved _close_ssh_proc function with the other half. This may actually explain some test suite problems — I think this may actually be an fd leak. So please extend your patch to do this.
That brings me to my other suggestion: I think we should strive to write at least one direct unit test for this code. It's now had multiple bugs, and I think it's proven that the indirect test coverage so far isn't enough. Off the top of my head a test that constructs a SSHSubprocessCo nnection directly may be a reasonable way to do it, but perhaps instantiating a custom SubprocessVendor would be better? So if you can think of a way to write some direct tests for the fd/process management in ssh.py, please do. I won't block this patch for lack of tests as it's a clear improvement, but I'd love to see some :)
Finally, add a NEWS entry! :)