Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix proxycommand leaks #2019

Merged
merged 4 commits into from
Oct 4, 2018
Merged

Conversation

greschd
Copy link
Member

@greschd greschd commented Oct 4, 2018

Fixes #2018 and fixes #1923 and fixes #1853

This addresses two issues:

  • The constructor of _DetachedProxyCommand should not call super. The reason for this is that the detached version creates a different subprocess. If the super is also called, two subprocesses are created.
  • In the close method of _DetachedProxyCommand, the subprocess is killed more aggressively, and we poll the subprocess to avoid having defunct processes.

The subprocess killing is implemented as follows:

  • .terminate() the subprocess
  • .poll() for 2 seconds to see if it exits
  • if it hasn't, .kill(), and .poll() again for 2 seconds

This part is a bit hand-wavy, but I wanted to avoid using the .wait() method. On balance I think it's better if the daemon just continues if the subprocess is really unkillable.

@greschd greschd requested a review from sphuber October 4, 2018 09:47
@coveralls
Copy link

coveralls commented Oct 4, 2018

Coverage Status

Coverage increased (+4.5%) to 67.692% when pulling 613e2a7 on greschd:fix_proxycommand_leaks into f9a5624 on aiidateam:develop.

Copy link
Contributor

@sphuber sphuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @greschd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants