From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
git@vger.kernel.org, Michael J Gruber <git@grubix.eu>
Subject: Re: [PATCH] http.c: clear the 'finished' member once we are done with it
Date: Tue, 24 May 2022 22:38:30 +0200 [thread overview]
Message-ID: <220524.86r14ivewt.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <xmqqleuqj1gy.fsf@gitster.g>
On Tue, May 24 2022, Junio C Hamano wrote:
> [...]
> This incidentally is a good illustration why the thread-starter
> patch that did
>
> if (&finished == slot->finished)
> slot->finished = NULL;
>
> would be sufficient, and the "clear only ours" guard is not
> necessary, I think. If the inner run_active_slot() did not trigger
> a callback that adds more reuse of the slot, it will clear
> slot->finished to NULL itself, with or without the guard. And the
> outer run_active_slot() may fail to clear if the guard is there, but
> slot->finished is NULL in that case, so there is no point in clearing
> it again.
>
> And if the inner run_active_slot() did trigger a callback that ended
> up reusing the slot, then eventually the innermost one would have
> cleared slot->finished to NULL, with or without the guard, before it
> returned the control to inner run_active_slot(). The inference goes
> the same way to show that the guard is not necessary but is not
> hurting.
>
> I _think_ we can even get away by not doing anything to
> slot->finished at the end of run_active_slot(), as we are not
> multi-threaded and the callee only returns to the caller, but if it
> helps pleasing the warning compiler, I'd prefer the simplest
> workaround, perhaps with an unconditional clearing there?
I'll admit I haven't fully looked into this again, but does anything in
the subsequent analysis suggest that my original patch wouldn't be a
working solution to this, still:
https://lore.kernel.org/git/patch-1.1-1cec367e805-20220126T212921Z-avarab@gmail.com/ ?
The advantage of it over any small and narrow fix like your hunk quoted
above is that it doesn't make the end result look as though we care
about e.g. thread races, which evidently is something more than one
person looking at this has (needlessly) ended up worrying about.
> What did I miss? I must be missing something, as I can explain how
> the current "(*slot->finished) = 1" with "while (finished)"
> correctly works, but I cannot quite explain why the original "while
> (slot->in_use)" would not, which is annoying.
Perhaps that change was also worried about thread safety? I only briefly
re-looked at this again, but I don't think I ever found exactly what
that 2006-era fix was meant to fix, specifically.
> In other words, why we needed baa7b67d (HTTP slot reuse fixes,
> 2006-03-10) in the first place? It is possible that we had some
> code paths that forgot to drop in_use before the inner run_active
> returned that have been fixed in the 16 years and this fix was
> hiding that bug, but I dunno.
I haven't found that out either, either back in January or just now.
next prev parent reply other threads:[~2022-05-24 20:44 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 18:04 [PATCH 0/2] quell a few gcc warnings Michael J Gruber
2022-05-06 18:04 ` [PATCH 1/2] dir.c: avoid gcc warning Michael J Gruber
2022-05-06 20:21 ` Junio C Hamano
2022-05-09 15:58 ` Taylor Blau
2022-05-07 6:14 ` Carlo Marcelo Arenas Belón
2022-05-06 18:04 ` [PATCH 2/2] http.c: " Michael J Gruber
2022-05-06 20:22 ` Junio C Hamano
2022-05-06 21:17 ` [PATCH] http.c: clear the 'finished' member once we are done with it Junio C Hamano
2022-05-07 5:40 ` Carlo Marcelo Arenas Belón
2022-05-07 18:42 ` Junio C Hamano
2022-05-07 19:11 ` Carlo Arenas
2022-05-23 21:58 ` Johannes Schindelin
2022-05-23 22:58 ` Junio C Hamano
2022-05-23 23:36 ` Junio C Hamano
2022-05-23 23:41 ` Johannes Schindelin
2022-05-24 0:02 ` Junio C Hamano
2022-05-24 6:31 ` Daniel Stenberg
2022-05-24 10:57 ` Johannes Schindelin
2022-05-24 17:45 ` Junio C Hamano
2022-05-26 14:15 ` Daniel Stenberg
2022-05-24 11:03 ` Johannes Schindelin
2022-05-24 17:15 ` Junio C Hamano
2022-05-24 20:16 ` Carlo Marcelo Arenas Belón
2022-05-24 20:45 ` Ævar Arnfjörð Bjarmason
2022-05-24 22:34 ` Junio C Hamano
2022-05-25 9:08 ` Michael J Gruber
2022-05-25 13:27 ` Ævar Arnfjörð Bjarmason
2022-05-24 22:16 ` Junio C Hamano
2022-05-24 23:19 ` Junio C Hamano
2022-05-25 2:02 ` Carlo Arenas
2022-05-24 20:38 ` Ævar Arnfjörð Bjarmason [this message]
2022-05-24 22:28 ` Junio C Hamano
2022-05-25 10:07 ` Johannes Schindelin
2022-05-25 16:40 ` Junio C Hamano
2022-05-06 20:41 ` [PATCH 2/2] http.c: avoid gcc warning Carlo Marcelo Arenas Belón
2022-05-09 11:22 ` [PATCH] detect-compiler: make detection independent of locale Michael J Gruber
2022-05-09 15:52 ` Junio C Hamano
2022-05-09 15:59 ` rsbecker
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=220524.86r14ivewt.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@grubix.eu \
--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).