Re: Regression tests fail on OpenBSD due to low semmns value

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Alexander Lakhin <exclusion(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Regression tests fail on OpenBSD due to low semmns value
Date: 2024-12-17 03:11:37
Message-ID: CA+hUKGKumYUweDKnF5S1Y_jKxMa94w_q8=j8-xDdhOgxcaVCiQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 16, 2024 at 6:00 PM Alexander Lakhin <exclusion(at)gmail(dot)com> wrote:
> It turned out that OpenBSD has semmns as low as 60 (see [4])

Whenever I run into this, or my Mac requires manual ipcrm to clean up
leaked SysV kernel junk, I rebase my patch for sema_kind = 'futex'.
Here it goes. It could be updated to support NetBSD I believe, but I
didn't try as its futex stuff came out later.

Then I remember why I didn't go anywhere with it. It triggers a
thought loop about flipping it all around: use futexes to implement
lwlocks directly in place, and get rid of semaphores completely, but
that involves a few rabbit holes and sub-projects. From memory:
classic r/w lock implementation on futexes is tricky but doable in the
portability constraints, futex fallback implementation even works
surprisingly well but has fun memory map sub-problems, actually lwlock
is not really a classic r/w lock as it has sprouted extra funky APIs
that lead the intrepid rabbit-holer to design an entirely different
new concurrency primitive that is really wanted for those users, a
couple of other places use raw semaphores directly namely procarray.c
and clog.c and if you stare at those for long you will be overwhelmed
with a desire to rewrite them, EOVERFLOW.

Attachment Content-Type Size
0001-A-basic-API-for-futexes.patch application/x-patch 10.9 KB
0002-Add-futex-based-semaphore-replacement.patch application/x-patch 8.7 KB
0003-Use-futex-based-semaphores-on-macOS.patch application/x-patch 1.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou (Fujitsu) 2024-12-17 03:24:47 RE: Conflict detection for update_deleted in logical replication
Previous Message Robins Tharakan 2024-12-17 02:54:49 Re: Cutting support for OpenSSL 1.0.1 and 1.0.2 in 17~?