summaryrefslogtreecommitdiffstats
path: root/git_config.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2010-05-11 18:21:33 -0700
committerShawn O. Pearce <sop@google.com>2010-05-11 18:31:47 -0700
commitca8c32cd7ae7c3ae27bb6b649eafbfd54d77f916 (patch)
tree20d74c26df2112515313b0b22c7358427bad8b57 /git_config.py
parentf0a9a1a30e60e92cec9bff4cae030478c276da4d (diff)
downloadgit-repo-ca8c32cd7ae7c3ae27bb6b649eafbfd54d77f916.tar.gz
sync: kill git fetch process before SSH control master processv1.6.9.6
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 <sop@google.com>
Diffstat (limited to 'git_config.py')
-rw-r--r--git_config.py7
1 files changed, 6 insertions, 1 deletions
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
23from urllib2 import urlopen, HTTPError 23from urllib2 import urlopen, HTTPError
24from error import GitError, UploadError 24from error import GitError, UploadError
25from trace import Trace 25from trace import Trace
26from git_command import GitCommand, ssh_sock 26
27from git_command import GitCommand
28from git_command import ssh_sock
29from git_command import terminate_ssh_clients
27 30
28R_HEADS = 'refs/heads/' 31R_HEADS = 'refs/heads/'
29R_TAGS = 'refs/tags/' 32R_TAGS = 'refs/tags/'
@@ -391,6 +394,8 @@ def _open_ssh(host, port):
391 return True 394 return True
392 395
393def close_ssh(): 396def close_ssh():
397 terminate_ssh_clients()
398
394 for key,p in _ssh_cache.iteritems(): 399 for key,p in _ssh_cache.iteritems():
395 try: 400 try:
396 os.kill(p.pid, SIGTERM) 401 os.kill(p.pid, SIGTERM)