From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/5] fix deadlock in git-push
Date: Wed, 20 Apr 2016 17:51:17 -0400 [thread overview]
Message-ID: <20160420215117.GA18297@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqwpnst1yb.fsf@gitster.mtv.corp.google.com>
On Wed, Apr 20, 2016 at 02:17:16PM -0700, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > The first patch below fixes the deadlock. Unfortunately, it turns it
> > into a likely SIGPIPE death. Which is an improvement, but not ideal.
> >
> > Patches 2 and 3 address that by fixing the way we handle SIGPIPE in
> > async threads.
> >
> > Patches 4 and 5 are cleanups to earlier topics that are enabled by the
> > new SIGPIPE handling.
> >
> > [1/5]: send-pack: close demux pipe before finishing async process
> > [2/5]: run-command: teach async threads to ignore SIGPIPE
> > [3/5]: send-pack: isolate sigpipe in demuxer thread
> > [4/5]: fetch-pack: isolate sigpipe in demuxer thread
> > [5/5]: t5504: drop sigpipe=ok from push tests
>
> Thanks for a very well explained series.
>
> We do not call finish_async (rather, we do not use async) from that
> many places, and from a cursory look this codepath is the only case
> where we may encounter this kind of deadlock (the ones in
> receive-pack is about relaying the error messages back to the other
> end over sideband multiplexing)?
Yeah, I checked the other demuxer in fetch-pack, but it does not have
any early returns like this (it just dies :) ).
It does not do an explicit close on demux.out, but I think it is
effectively closed when we hand it off to index-pack/unpack-objects via
cmd.in.
Arguably finish_async() should "close(demux.out)" itself, but that felt
like an ownership violation. Yes, that's how "struct async" passes out
the descriptor, but the caller is then expected to handle it, and
correct callers will typically have closed it themselves, handed it off
to a sub-process, etc. Closing it in finish_async() runs the risk that
we just call close() on a descriptor number that is either unattached,
or attached to some random other thing.
-Peff
prev parent reply other threads:[~2016-04-20 21:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-19 22:39 [PATCH 0/5] fix deadlock in git-push Jeff King
2016-04-19 22:45 ` [PATCH 1/5] send-pack: close demux pipe before finishing async process Jeff King
2016-04-19 22:49 ` [PATCH 2/5] run-command: teach async threads to ignore SIGPIPE Jeff King
2016-04-21 5:15 ` Johannes Sixt
2016-04-21 5:18 ` Jeff King
2016-04-19 22:50 ` [PATCH 3/5] send-pack: isolate sigpipe in demuxer thread Jeff King
2016-04-19 22:50 ` [PATCH 4/5] fetch-pack: " Jeff King
2016-04-19 22:51 ` [PATCH 5/5] t5504: drop sigpipe=ok from push tests Jeff King
2016-04-20 21:17 ` [PATCH 0/5] fix deadlock in git-push Junio C Hamano
2016-04-20 21:51 ` Jeff King [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160420215117.GA18297@sigill.intra.peff.net \
--to=peff@peff.net \
--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.
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 NNTP newsgroup(s).