| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Add assertion on held AddinShmemInitLock in GetNamedLWLockTranche() |
| Date: | 2023-07-28 03:24:28 |
| Message-ID: | ZMM07Bw8ZvSQ4hJp@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi all,
While digging into the LWLock code, I have noticed that
GetNamedLWLockTranche() assumes that its caller should hold the LWLock
AddinShmemInitLock to prevent any kind of race conditions when
initializing shmem areas, but we don't make sure that's the case.
The sole caller of GetNamedLWLockTranche() in core respects that, but
out-of-core code may not be that careful. How about adding an
assertion based on LWLockHeldByMeInMode() to make sure that the
ShmemInit lock is taken when this routine is called, like in the
attached?
Thanks,
--
Michael
| Attachment | Content-Type | Size |
|---|---|---|
| lwlock-assert.patch | text/x-diff | 522 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alexander Lakhin | 2023-07-28 04:00:01 | Re: Postgres v15 windows bincheck regression test failures |
| Previous Message | Andres Freund | 2023-07-28 02:23:32 | Re: Support worker_spi to execute the function dynamically. |