From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Christian Couder" <christian.couder@gmail.com>,
git@vger.kernel.org, "Taylor Blau" <me@ttaylorr.com>,
"SZEDER Gábor" <szeder.dev@gmail.com>,
"Derrick Stolee" <dstolee@microsoft.com>,
"Christian Couder" <chriscool@tuxfamily.org>
Subject: Re: [PATCH v2] fetch-pack: try harder to read an ERR packet
Date: Tue, 28 Apr 2020 14:02:33 -0700 [thread overview]
Message-ID: <xmqqh7x31fyu.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200428204908.GA4000@coredump.intra.peff.net> (Jeff King's message of "Tue, 28 Apr 2020 16:49:08 -0400")
Jeff King <peff@peff.net> writes:
>> Hmm, if the connection gets severed just before the ERR packet the
>> other side has written, we will see "Broken pipe" if we write
>> "done", and no amount of "try to read to collect as much what they
>> said as possible" would help. If you are lucky and the connection
>> is broken after the ERR reaches on this side, such an "extra effort"
>> may help, but is it really worth the effort? It is not clear to me
>> if the extra complexity, one more API function people need to learn,
>> and the need to think which one to use every time they want to say
>> write_in_full(), are justifiable.
>
> I think the "lucky" case happens pretty routinely. The situation we're
> trying to catch here is that server does:
>
> packet_write("ERR I don't like your request for some reason");
> die("exiting");
OK, if we assume that the communication route is never flaky and
everything writtten will go through before TCP shutdown that would
happen when die() kills the process (or like test environment that
most communication goes locally between two processes), sure, it may
look common enough to be worth "fixing". I simply did not realize
that was the shared assumption behind this patch before I went back
to the original discussion that was about a racy test.
As long as an extra read on the side that just got a write error
won't throw us into a deadlock, I think I am OK, but I am still not
sure if the code complexity to have two write_in_full() is worth it.
If the mechanism to do this were limited to the packet IO layer, it
may be more palatable, though.
next prev parent reply other threads:[~2020-04-28 21:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 7:44 [PATCH v2] fetch-pack: try harder to read an ERR packet Christian Couder
2020-04-28 19:24 ` Junio C Hamano
2020-04-28 19:59 ` Taylor Blau
2020-04-28 20:51 ` Jeff King
2020-04-28 20:49 ` Jeff King
2020-04-28 21:02 ` Junio C Hamano [this message]
2020-04-28 21:17 ` Jeff King
2020-04-28 21:23 ` Junio C Hamano
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=xmqqh7x31fyu.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=chriscool@tuxfamily.org \
--cc=christian.couder@gmail.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=peff@peff.net \
--cc=szeder.dev@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.
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).