Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-10 Thread Craig Ringer
On 11 Dec. 2016 07:44, "Tom Lane" wrote: I think we need to do at least this much for v10, because otherwise we'll face ABI issues if an extension is compiled against code with one semaphore API choice and used with code with a different one. +1, this is a good idea. Your

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-10 Thread Tom Lane
Robert Haas writes: > On Wed, Dec 7, 2016 at 3:12 PM, Tom Lane wrote: >> As things stand, it's only a configure-time choice, but I've been >> thinking that we might be well advised to make it run-time configurable. > Sure. A configure-time choice only

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-08 Thread Robert Haas
On Thu, Dec 8, 2016 at 12:40 PM, Tom Lane wrote: > Ah-hah, thanks for the insight. I can now reproduce it, and I confirm > that aside from removing the semaphores, our POSIX shmem segment(s) > are removed from /dev/shm. They presumably still are attached to whatever >

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-08 Thread Tom Lane
Peter Eisentraut writes: > On 12/7/16 9:28 PM, Alex Hunsaker wrote: >> Hrm, the following incantation seems to break for me on a fresh Fedora >> 25 system: >> 1) As root su to $USER and start postgres. >> 2) ssh in as $USER and then logout >> 3) # psql localhost

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-08 Thread Peter Eisentraut
On 12/7/16 9:28 PM, Alex Hunsaker wrote: > Hrm, the following incantation seems to break for me on a fresh Fedora > 25 system: > 1) As root su to $USER and start postgres. > 2) ssh in as $USER and then logout > 3) # psql localhost > > FATAL: semctl(4980742, 3, SETVAL, 0) failed: Invalid argument

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-08 Thread Peter Eisentraut
On 12/7/16 9:38 AM, Tom Lane wrote: >> Even with that change, dynamic shared memory is still vulnerable to be >> removed. > Really? I thought we concluded that it is safe because it is detectably > attached to running processes. The DSM implementation uses POSIX shared memory, which doesn't have

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Alex Hunsaker
On Wed, Dec 7, 2016 at 3:42 PM, Tom Lane wrote: > > > Hmm ... after further experimentation, I still can't get this version of > systemd (231) to do anything evil. It turns out that Fedora ships it with > KillUserProcesses turned off by default, and maybe having that on is a

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Tom Lane
Robert Haas writes: > On Wed, Dec 7, 2016 at 6:49 PM, Tom Lane wrote: >> This still doesn't address the real question, which is whether RemoveIPC >> does anything if KillUserProcesses is off, and whether that behavior >> has changed. I don't see

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Robert Haas
On Wed, Dec 7, 2016 at 6:49 PM, Tom Lane wrote: > Alvaro Herrera writes: >> Tom Lane wrote: >>> Color me confused ... maybe systemd's behavior has changed? > >>

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Tom Lane
Alvaro Herrera writes: > Tom Lane wrote: >> Color me confused ... maybe systemd's behavior has changed? > https://lists.fedoraproject.org/archives/list/de...@lists.fedoraproject.org/thread/ZNQW72UP36UAFMX53HPFFQTWTQDZVJ3M/ I see Lennart hasn't gotten any less convinced

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Alvaro Herrera
Tom Lane wrote: > Hmm ... after further experimentation, I still can't get this version of > systemd (231) to do anything evil. It turns out that Fedora ships it with > KillUserProcesses turned off by default, and maybe having that on is a > prerequisite for the other behavior? But that doesn't

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Andres Freund
On 2016-12-06 23:54:43 -0500, Tom Lane wrote: > You're attacking a straw man. I didn't propose changing our behavior > anywhere but Linux. AFAIK, on that platform unnamed POSIX semaphores > are futexes, which have been a stable feature since 2003 according to >

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Andres Freund
Hi, On 2016-12-06 21:53:06 -0500, Tom Lane wrote: > Just saw another report of what's probably systemd killing off Postgres' > SysV semaphores, as we've discussed previously at, eg, > https://www.postgresql.org/message-id/flat/57828C31.5060409%40gmail.com > Since the systemd people are generally

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Tom Lane
Alex Hunsaker writes: > On Wed, Dec 7, 2016 at 1:12 PM, Tom Lane wrote: >> But this is all kind of moot if Peter is right that systemd will zap >> POSIX shmem along with SysV semaphores. I've been trying to reproduce >> the issue on a Fedora 25

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Alex Hunsaker
On Wed, Dec 7, 2016 at 1:12 PM, Tom Lane wrote: > But this is all kind of moot if Peter is right that systemd will zap > POSIX shmem along with SysV semaphores. I've been trying to reproduce > the issue on a Fedora 25 installation, and so far I can't get it to > zap

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Robert Haas
On Wed, Dec 7, 2016 at 3:12 PM, Tom Lane wrote: > Robert Haas writes: >> On Tue, Dec 6, 2016 at 11:54 PM, Tom Lane wrote: >>> Robert Haas writes: On Tue, Dec 6, 2016 at 9:53 PM, Tom Lane

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Tom Lane
Robert Haas writes: > On Tue, Dec 6, 2016 at 11:54 PM, Tom Lane wrote: >> Robert Haas writes: >>> On Tue, Dec 6, 2016 at 9:53 PM, Tom Lane wrote: I think we should give serious consideration to

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Robert Haas
On Tue, Dec 6, 2016 at 11:54 PM, Tom Lane wrote: > Robert Haas writes: >> On Tue, Dec 6, 2016 at 9:53 PM, Tom Lane wrote: >>> I think we should give serious consideration to back-patching commit >>> ecb0d20a9, which changed the

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Tom Lane
Peter Eisentraut writes: > On 12/6/16 9:53 PM, Tom Lane wrote: >> I think we should give serious consideration to back-patching commit >> ecb0d20a9, which changed the default semaphore type to unnamed-POSIX >> on Linux. > Even with that change, dynamic shared

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Stephen Frost
All, * Peter Eisentraut (peter.eisentr...@2ndquadrant.com) wrote: > On 12/6/16 9:53 PM, Tom Lane wrote: > > I think we should give serious consideration to back-patching commit > > ecb0d20a9, which changed the default semaphore type to unnamed-POSIX > > on Linux. > > Even with that change,

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Peter Eisentraut
On 12/6/16 9:53 PM, Tom Lane wrote: > I think we should give serious consideration to back-patching commit > ecb0d20a9, which changed the default semaphore type to unnamed-POSIX > on Linux. Even with that change, dynamic shared memory is still vulnerable to be removed. So backpatching the

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-07 Thread Magnus Hagander
On Wed, Dec 7, 2016 at 7:18 AM, Craig Ringer wrote: > On 7 December 2016 at 10:53, Tom Lane wrote: > > Just saw another report of what's probably systemd killing off Postgres' > > SysV semaphores, as we've discussed previously at, eg, > >

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-06 Thread Craig Ringer
On 7 December 2016 at 10:53, Tom Lane wrote: > Just saw another report of what's probably systemd killing off Postgres' > SysV semaphores, as we've discussed previously at, eg, > https://www.postgresql.org/message-id/flat/57828C31.5060409%40gmail.com > Since the systemd people

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-06 Thread Tatsuo Ishii
> Potential risks involving minor upgrades are far higher than the risks > involved by systemd, so -1 for a backpatch seen from here. As long as we would have a compile time switch to enable/disable the back-patched feature, it seems it would be acceptable. In the worst case, the back-patching

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-06 Thread Michael Paquier
On Wed, Dec 7, 2016 at 1:43 PM, Robert Haas wrote: > Urk. That sounds like a scary thing to back-patch. The fact that the > buildfarm has reported no problems is good as far as it goes, but user > environments can be expected to be considerably more diverse than the >

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-06 Thread Tom Lane
Robert Haas writes: > On Tue, Dec 6, 2016 at 9:53 PM, Tom Lane wrote: >> I think we should give serious consideration to back-patching commit >> ecb0d20a9, which changed the default semaphore type to unnamed-POSIX >> on Linux. > Urk. That sounds like

Re: [HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-06 Thread Robert Haas
On Tue, Dec 6, 2016 at 9:53 PM, Tom Lane wrote: > Just saw another report of what's probably systemd killing off Postgres' > SysV semaphores, as we've discussed previously at, eg, > https://www.postgresql.org/message-id/flat/57828C31.5060409%40gmail.com > Since the systemd

[HACKERS] Back-patch use of unnamed POSIX semaphores for Linux?

2016-12-06 Thread Tom Lane
Just saw another report of what's probably systemd killing off Postgres' SysV semaphores, as we've discussed previously at, eg, https://www.postgresql.org/message-id/flat/57828C31.5060409%40gmail.com Since the systemd people are generally impervious to suggestions that they might be mistaken, I do