From: Kai Zhang <kai@netskope.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Bug report: Git pull hang occasionally
Date: Wed, 21 Dec 2016 13:10:18 -0800 [thread overview]
Message-ID: <EB5CD780-BDDA-44C5-BD7D-1325F5891926@netskope.com> (raw)
In-Reply-To: <xmqq8tr9huc0.fsf@gitster.mtv.corp.google.com>
Thank you for your insight and detailed explanation Junio.
I think what you said is what is happening in my environment. Both writing and reading are happening simultaneously.
> On Dec 21, 2016, at 12:59 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
> Kai Zhang <kai@netskope.com> writes:
>
>> 2016/12/20 20:38:10 [error] 9957#0: *687703 FastCGI sent in stderr: "fatal: 'HEAD' is a symref but it is not?" while reading response header from upstream, client: 10.1.0.11, server: server, request: "POST /git/repo_name/.git/git-upload-pack HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "server"
>
> (Not a solution)
>
> In order to tell the client if HEAD is a symbolic ref and to what
> underlying ref it points at if it is a symbolic ref, at the very
> beginning of upload-pack, there is a call to head_ref_namespaced()
> that uses find_symref(). find_symref() gets "HEAD" and a boolean
> that says if it is a symbolic ref, but it does not get where the
> symbolic ref points at, so it does resolve_ref_unsafe() to learn
> that information.
>
> Between the time head_ref_namespaced() checks the refs database and
> finds that HEAD is a symbolic ref, and the time find_symref() calls
> resolve_ref_unsafe() to find out where it leads to, if somebody else
> updates HEAD, resolve_ref_unsafe() can give an unexpected result, as
> all of these read-only operations are performed without any locking.
>
> And the unexpected discrepancy is reported by find_symref() as
> fatal. The server side dies, and somehow that fact is lost between
> the upload-pack process and the client and somebody in the middle
> (e.g. fastcgi interface or nginx webserver on the server side, or
> the remote-curl helper on the client side) keeps the "git fetch"
> process waiting.
>
> So there seem to be two issues.
>
> - Because of the unlocked read, find_symref() can observe an
> inconsistent state. Perhaps it should be updated not to die but
> to retry, expecting that transient inconsistency will go away.
>
> - A fatal error in upload-pack is not reported back to the client
> to cause it exit is an obvious one, and even if we find a way to
> make this fatal error in find_symref() not to trigger, fatal
> errors in other places in the code can trigger the same symptom.
>
next prev parent reply other threads:[~2016-12-21 21:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-21 19:47 Bug report: Git pull hang occasionally Kai Zhang
2016-12-21 20:59 ` Junio C Hamano
2016-12-21 21:10 ` Kai Zhang [this message]
2016-12-21 21:32 ` Junio C Hamano
2016-12-21 22:31 ` Kai Zhang
2017-01-12 18:24 ` Kai Zhang
2017-01-12 21:12 ` Junio C Hamano
2017-01-12 21:17 ` Kai Zhang
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=EB5CD780-BDDA-44C5-BD7D-1325F5891926@netskope.com \
--to=kai@netskope.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).