Re: Problem with frequent crashes related to semctl - Mailing list pgsql-general

From Adrian Maier
Subject Re: Problem with frequent crashes related to semctl
Date
Msg-id 22139_1289292891_4CD90C5B_22139_127499_1_4CD90CD8.3080703@thalesgroup.com
Whole thread Raw
In response to Re: Problem with frequent crashes related to semctl  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 11/05/2010 05:02 PM, Tom Lane wrote:
> Adrian Maier<adrian.maier@thalesgroup.com>  writes:
>> I am running PostgreSQL 8.3.5 on a linux machine (Ubuntu 10.04).
>> Sometimes it happens that connecting to the database fails with error :
>
>>       FATAL:  semctl(360458, 3, SETVAL, 0) failed: Invalid argument (PGError)
>
>> If i restart postgres the problem gets "fixed".  It doesn't matter how do i
>> connect to the database :  i saw this happening from psql, from jdbc, and
>> from ruby.
>
> The most likely theory is that something deleted Postgres' semaphores
> out from under it.  You could check this by noting the output of "ipcs -s"
> while the database is running normally, and then comparing to the output
> after it starts to fail.
>
> If that does seem to be what's happening, look around for root-executed
> scripts doing "ipcrm" calls.

Tom,
Thanks for the tip.

The semaphores are indeed deleted with ipcrm from a script. The script is
(re)starting another application and it simply erases all the semaphores
without taking into account the possibility that some semaphores are actually
belonging to another process...

I'll simply move the postgres installation to be started by another user. Doing
this should protect the postgres semaphores against the script (which is
executed as a regular user, not root).



Thanks,
Adrian Maier

pgsql-general by date:

Previous
From: Sachin Srivastava
Date:
Subject: Re: Run "postgresql\9.0\data" on a RAID-1 disk on my Local Area Network (LAN)
Next
From: Matthieu Huin
Date:
Subject: Re: temporary table as a subset of an existing table and indexes