From ca8c32cd7ae7c3ae27bb6b649eafbfd54d77f916 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 11 May 2010 18:21:33 -0700 Subject: sync: kill git fetch process before SSH control master process If the SSH control master process is killed while an active git fetch is using its network socket, the underlying SSH client may not realize the connection was broken. This can lead to both the client and the server waiting indefinitely for network messages which will never be sent. Work around the problem by keeping track of any processes that use the tunnels we establish. If we are about to kill any of the SSH control masters that we started, ensure the clients using them are successfully killed first. Change-Id: Ida6c124dcb0c6a26bf7dd69cba2fbdc2ecd5b2fc Signed-off-by: Shawn O. Pearce --- git_config.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'git_config.py') diff --git a/git_config.py b/git_config.py index a7c82107..75936d40 100644 --- a/git_config.py +++ b/git_config.py @@ -23,7 +23,10 @@ from signal import SIGTERM from urllib2 import urlopen, HTTPError from error import GitError, UploadError from trace import Trace -from git_command import GitCommand, ssh_sock + +from git_command import GitCommand +from git_command import ssh_sock +from git_command import terminate_ssh_clients R_HEADS = 'refs/heads/' R_TAGS = 'refs/tags/' @@ -391,6 +394,8 @@ def _open_ssh(host, port): return True def close_ssh(): + terminate_ssh_clients() + for key,p in _ssh_cache.iteritems(): try: os.kill(p.pid, SIGTERM) -- cgit v1.2.3-54-g00ecf