Re: POSIX shared memory redux

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "A(dot)M(dot)" <agentm(at)themactionfaction(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: POSIX shared memory redux
Date: 2011-04-14 01:09:43
Message-ID: 2691.1302743383@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> In answer to your off-list question, one of the principle ways I've
> seen fcntl() locking fall over and die is when someone removes the
> lock file. You might think that this could be avoided by picking
> something important like pg_control as the log file, but it turns out
> that doesn't really work:

> http://0pointer.de/blog/projects/locking.html

Hm, I wasn't aware of the fact that you lose an fcntl() lock if you
close a *different* file descriptor for the same file. My goodness,
that's horrid :-(. It basically means that any third-party code running
in a backend could accidentally defeat the locking, and most of the time
you'd never even know it had happened ... as opposed to what would
happen if you detached from shmem for instance. You could run with such
code for years, and probably never know why sometimes the interlock
failed to work when you needed it to.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message A.M. 2011-04-14 01:11:43 Re: POSIX shared memory redux
Previous Message Robert Haas 2011-04-14 00:36:44 Re: POSIX shared memory redux