git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Jason Vas Dias <jason.vas.dias@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: clone hang prevention / timeout?
Date: Tue, 12 Apr 2016 08:01:49 +0000	[thread overview]
Message-ID: <20160412080149.GA9087@dcvr.yhbt.net> (raw)
In-Reply-To: <CALyZvKwxE4T8-FmEYgPMgAFKLmeAY5f-y-mDL8S9twTb0umRaA@mail.gmail.com>

Jason Vas Dias <jason.vas.dias@gmail.com> wrote:
> It appears GIT has no way of specifying a timeout for a clone operation -
> if the server decides not to complete a get request, the clone can
> hang forever -
> is this correct ?

git uses SO_KEEPALIVE for all connections it makes, so whatever
your kernel TCP keepalive knobs are set at.

By default, it's very long (around 2 hours), but you can change them
using the tcp_keepalive_* knobs in /proc/sys/net/ipv4/ under Linux.

I suppose we can do shorter timeouts (at least under Linux) via
setsockopt(.. TCP_KEEP*) knobs, or we can call poll() ourselves
to timeout connections.  However, git packing operations on the
server can take a long time; so it might be bad to timeout
manually unless we know the connection is really dead.

> This appears to be what I am seeing, in a script that is attempting to do many
> successive clone operations, eg. of
> git://anongit.freedesktop.org/xorg/* , the script
> occasionally hangs in a clone - I can see with netstat + strace that the TCP
> connection is open and GIT is trying to read .
> Is there any option I can specify to get the clone to timeout, or do I manually
> have to strace the git process and send it a signal after a hang is detected?

I added git:// support for SO_KEEPALIVE in commit e47a8583a202
("enable SO_KEEPALIVE for connected TCP sockets")
back in 2011 (v1.7.10),
and http:// support later in 2013 (v1.8.5) with
commit a15d069a1986 ("http: enable keepalive on TCP sockets")

  reply	other threads:[~2016-04-12  8:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-11 21:49 clone hang prevention / timeout? Jason Vas Dias
2016-04-12  8:01 ` Eric Wong [this message]
2016-04-13 22:24 ` Jeff King
2016-04-13 22:29 ` Jeff King
2016-04-14 18:32   ` Jason Vas Dias
2016-04-30  9:04     ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160412080149.GA9087@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=git@vger.kernel.org \
    --cc=jason.vas.dias@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).