git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] upload-pack: fix race condition in error messages

From
Derrick Stolee <stolee@gmail.com>
Date
Aug 29, 2019, 14:27 UTC
Message-ID
<131dfa37-0f65-f0c3-6f30-5b6eca12d9c0@gmail.com>
In-Reply-To
<20190829141307.GE1797@sigill.intra.peff.net>
On 8/29/2019 10:13 AM, Jeff King wrote:
Show 14 quoted lines
> On Thu, Aug 29, 2019 at 08:58:55AM -0400, Derrick Stolee wrote:
> 
>> However, I do have a theory: the process exits before flushing the
>> packet line. Adding this line before exit(1) should fix it:
>>
>> 	packet_writer_flush(writer);
>>
>> I can send this in a v2, but it would be nice if you could test this
>> in your environment that already demonstrated the failure.
> 
> I don't think we should need such a call. For one thing, if it were
> necessary, that would mean we're not writing out the packet at all. But
> your whole problem is that we're writing the message twice, one of which
> comes from the packet.

The problem the flush() was trying to solve was the new "Broken pipe" error, which I had assumed was due to a communication race. (Looking at the message more closely now, I see that Szeder was able to repro this broken pipe both with and without my change. I am still unable to repro the broken pipe.)

Show 6 quoted lines
> Second is that this is not "flush the output stream", but "write a flush
> packet". The packet_writer_error() function immediately calls write()
> without buffering. And no matter where we are in the conversation, a
> flush packet would not be necessary, because the error packet we send
> would be interpreted immediately by the client as aborting the
> connection.
This clearly shows that my proposed solution is absolutely wrong.

Thanks, -Stolee

Previous: Jeff KingNext: Jeff King
Message 9 of 15 in “upload-pack: fix race condition in t5516”
  1. 0/1 upload-pack: fix race condition in t5516Derrick Stolee via GitGitGadget, Aug 28, 2019
  2. 1/1 upload-pack: fix race condition in error messagesDerrick Stolee via GitGitGadget, Aug 28, 2019
  3. SZEDER GáborAug 28, 2019
  4. Jeff KingAug 28, 2019
  5. Jeff KingAug 28, 2019
  6. SZEDER GáborAug 28, 2019
  7. Derrick StoleeAug 29, 2019
  8. Jeff KingAug 29, 2019
  9. Derrick StoleeAug 29, 2019
  10. Jeff KingAug 29, 2019
  11. SZEDER GáborAug 29, 2019
  12. SZEDER GáborAug 29, 2019
  13. SZEDER GáborAug 30, 2019
  14. Jeff KingSep 4, 2019
  15. SZEDER GáborSep 10, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.