"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: make 'got send' detect closed connections
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Thu, 14 Sep 2023 18:51:55 +0200

Download raw body.

Thread
On Thu, Sep 14, 2023 at 05:59:41PM +0200, Omar Polo wrote:
> One minor optimization of
> your original diff could be do to not poll() when we're writing the
> packfile, a connection closed there results in a write() failure.

Huh, good point. Thinking about this, the problem becomes more clear:

So when got-send-pack was written the pack creation code did not yet
support output to network sockets (nowadays it does, thanks to gotd).

For this reason the pack file is written to a temporary file on disk.
Once that is done this temp file is spooled to the socket by got-send-pack.

got-send-pack exits as soon as it sees an error from gotsh:

16419 commits coloredgotsh: operation timed out
228961 commits colored; 48 objects found; 7581 trees scanned
packing 1 reference; 48 objects; deltify: 100%; writing pack:  109K 100%
got: privsep peer process closed pipe # <-- here we would usually start
 uploading and then "writing pack:" above would change to "uploading pack:"

Perhaps the best fix would be to avoid using the temporary file and spool
the pack file directly to got-send-pack instead. Then we should be able
to relay errors from got-send-pack to the main process immediately during
the pack creation phase.
This would be a larger change, though. I might tackle it at some point
when I find some free time.
For now, I will commit my workaround with poll. This will be removed
again once we refactor the code to skip the temporary file.