From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "Ted Nyman" <tnyman@openai.com>,
git@vger.kernel.org, "Taylor Blau" <me@ttaylorr.com>,
"Patrick Steinhardt" <ps@pks.im>,
"Karthik Nayak" <karthik.188@gmail.com>,
"brian m. carlson" <sandals@crustytoothpaste.net>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH 1/2] http: use unique tempfiles for packfile URI downloads
Date: Tue, 14 Jul 2026 11:10:43 -0700 [thread overview]
Message-ID: <xmqqcxwptpb0.fsf@gitster.g> (raw)
In-Reply-To: <20260714052833.GA2516582@coredump.intra.peff.net> (Jeff King's message of "Tue, 14 Jul 2026 01:28:33 -0400")
Jeff King <peff@peff.net> writes:
> On Mon, Jul 13, 2026 at 06:58:24PM -0700, Ted Nyman wrote:
>
>> > Are there better ways for these processes to coordinate with each
>> > other? Instead of appending to the file, what if the second process
>> > uses a predictable temporary name (which we already use) to open a
>> > new file with O_CREAT | O_EXCL to avoid this redundant work?
>>
>> Using the existing pack-<hash>.pack.temp name with O_CREAT | O_EXCL
>> would prevent concurrent writes, but EEXIST alone would not
>> distinguish an in-progress download from one left by an earlier
>> failed or interrupted invocation. The existing .pack.temp name is not
>> covered by the tmp_* pruning path, so simply waiting for it to
>> disappear could leave a fetch stuck after a crash.
>
> A few thoughts:
>
> - Using O_EXCL makes this essentially a lockfile. So we could apply
> the logic used elsewhere for lockfiles, like auto-removing files
> with ancient mtimes. Or we could even go all-in with a pid check for
> liveness; most of Git's lockfiles don't do that, but at least one
> does (the background auto-gc lock).
>
> - If we're not already using a name which is auto-cleaned during
> maintenance, we probably ought to be. Leaving aside concurrency
> issues, nobody would ever clean up the on-disk cruft.
>
> But of course the original code here is intentionally _not_ using a
> name we'd clean up, because it wants to be able to resume an
> interrupted transfer. And you're explicitly breaking that for the
> packfile URI case.
>
> Is that a cost we're OK with paying? Fixing it opens up that same
> coordination can of worms. You have to tell the difference a
> concurrent writer and a previous dead one (whose work you can
> resume).
>
> It does feel weird that we'd do one thing for dumb-http and another
> for packfile URIs. Wouldn't they suffer from the same concurrency
> and resumption problems?
> ...
>
> If we're OK with killing the ability to resume, then yeah, I think it
> would make sense to start simple and un-break things. And then put a
> coordination layer on top later (or never if nobody cares enough).
I share that sentiment. I am not entirely convinced by Ted's
response, since a major goal of the packfile URI feature, as I
understand it, is to allow the use of resumable protocols for
large transfers. The proposed change deliberately closes the
door on resuming interrupted transfers, whether manually or,
with additional code in the future, automatically.
next prev parent reply other threads:[~2026-07-14 18:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 22:37 [PATCH 0/2] packfile URIs: support concurrent downloads Ted Nyman
2026-07-13 22:34 ` [PATCH 1/2] http: use unique tempfiles for packfile URI downloads Ted Nyman
2026-07-14 1:00 ` Junio C Hamano
2026-07-14 1:58 ` Ted Nyman
2026-07-14 4:07 ` Taylor Blau
2026-07-14 5:28 ` Jeff King
2026-07-14 18:10 ` Junio C Hamano [this message]
2026-07-14 18:31 ` Ted Nyman
2026-07-14 4:06 ` Taylor Blau
2026-07-14 5:44 ` Jeff King
2026-07-14 6:46 ` Jeff King
2026-07-13 22:34 ` [PATCH 2/2] fetch-pack: accept "pack" output for packfile URIs Ted Nyman
2026-07-14 7:12 ` Jeff King
2026-07-14 7:13 ` Jeff King
2026-07-14 18:38 ` Ted Nyman
2026-07-14 4:13 ` [PATCH 0/2] packfile URIs: support concurrent downloads Taylor Blau
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=xmqqcxwptpb0.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=me@ttaylorr.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
--cc=sandals@crustytoothpaste.net \
--cc=tnyman@openai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.