Re: Injection point: fix race condition between attach and cleanup

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: sawada(dot)mshk(at)gmail(dot)com
Cc: kuroda(dot)hayato(at)fujitsu(dot)com, michael(at)paquier(dot)xyz, pgsql-hackers(at)lists(dot)postgresql(dot)org, exclusion(at)gmail(dot)com
Subject: Re: Injection point: fix race condition between attach and cleanup
Date: 2026-11-20 02:12:11
Message-ID: 20261120.111211.319693022042225738.horikyota.ntt@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

At Wed, 18 Nov 2026 16:33:12 -0800, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote in
> > > FWIW, I've read your patch, and I am absolutely unconvinced about the
> > > fact that we need to complicate the server side injpoint functionality
> > > in core for only this purpose. Test facilities like this one should
> > > remain simple in design, even if they require tweaks sometimes.
> > > Complicating them would lead to bugs in the facility. I know that I
> > > am pretty adamant about this part of the code, but injpoints are used
> > > for many cases across the whole tree, and what you are doing is
> > > changing one property for another, complicating the code even further,
> > > while on it.
>
> Agreed. I suggested the tracking idea in the original thread, but
> having looked at the patch, it's more complex than I expected.
...
> The same detach-and-attach race can happen in principle for isolation
> tests too, if a spec leaves a local point to be cleaned up on exit
> while another spec reuses the same name. But I don't think that needs
> handling. Using distinct names (or detaching explicitly) avoids it,
> and it doesn't seem worth special handling on the injection point
> side.

As I understand it, local injection points are a private feature of
the injection_points test module, and they are not designed to support
multiple sessions independently managing injection points with the
same name.

I see this primarily as an issue with how injection points are used in
tests, rather than a race condition that needs to be handled by the
underlying injection point infrastructure or even by the local
injection point implementation. Therefore, I'm also opposed to adding
machinery to either of them to address it.

I haven't looked into this very deeply, but I agree with Michael and
Sawada-san that using distinct injection point names in the test
scripts seems to be the simplest solution and should be sufficient.

Regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Keyerror Smart 2026-11-20 02:14:13 Re: [PATCH] Consider window functions when reordering GROUP BY items
Previous Message Tomas Vondra 2026-11-20 01:55:59 Re: Parallel GIN, BRIN builds fail to maintain ii_BrokenHotChain