Re: IpcSemaphoreLock/Unlock and proc_exit on 7.2.6

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: IpcSemaphoreLock/Unlock and proc_exit on 7.2.6
Date: 2004-11-15 00:18:22
Message-ID: 28001.1100477902@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kris Jurka <books(at)ejurka(dot)com> writes:
> I have an underpowered server running 7.2.6 that backs a website which
> occasionally gets hit by a bunch of traffic and starts firing off "FATAL
> 1: Sorry, too many clients already" messages. This is all as expected,
> but sometimes it just crashes. I had no clue what was going on until I
> checked the stderr log (because I had set it up to use syslog). In there
> I find a whole bunch of these:

> IpcSemaphoreLock: semop(id=-1) failed: Invalid argument

[ eyeballs code... ] It looks like this could happen in 7.2 during exit
from a backend that failed to acquire a semaphore --- ProcKill does
things like LockReleaseAll, which needs to acquire the lockmanager LWLock,
which could try to block using the process semaphore if there's
contention for the LWLock. The problem should be gone in 7.3 and later
due to reorganization of the semaphore management code. I'm not sure
it's worth trying to fix in 7.2.* --- the odds of introducing new
problems seem too high, and we're not really maintaining 7.2 anymore
anyway.

The comment in ProcGetNewSemIdAndNum suggests that you might be able to
suppress the problem in 7.2 by using a different max_connections value.
Is your current value one less than a multiple of 16, by any chance?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kris Jurka 2004-11-15 01:04:45 Re: IpcSemaphoreLock/Unlock and proc_exit on 7.2.6
Previous Message Tom Lane 2004-11-14 23:54:19 Re: GiST: PickSplit and multi-attr indexes