Thread: 7.4 - TODO : IpcSemaphoreCreate: No space left on device

7.4 - TODO : IpcSemaphoreCreate: No space left on device

From
"Dan Langille"
Date:
This error is accompanied by a suggestion to change SEMMNI or SEMMNS. In this case, that suggestion is not appropriate.
Read below for 
 
the scenario.

Suggestion: Can we modify the error message to include checking for a 
running postmaster?

Reasoning:

During my dbinit, I found the following error message.

# su -l pgsql -c initdb
The files belonging to this database system will be owned by user 
"pgsql".
This user must also own the server process.

The database cluster will be initialized with locale C.

creating directory /usr/local/pgsql/data... ok
creating directory /usr/local/pgsql/data/base... ok
creating directory /usr/local/pgsql/data/global... ok
creating directory /usr/local/pgsql/data/pg_xlog... ok
creating directory /usr/local/pgsql/data/pg_clog... ok
creating template1 database in /usr/local/pgsql/data/base/1... 
IpcSemaphoreCreate: semget(key=1, num=17, 03600) failed: No space 
left on device

This error does *not* mean that you have run out of disk space.

It occurs when either the system limit for the maximum number of
semaphore sets (SEMMNI), or the system wide maximum number of
semaphores (SEMMNS), would be exceeded.  You need to raise the
respective kernel parameter.  Alternatively, reduce PostgreSQL's
consumption of semaphores by reducing its max_connections parameter
(currently 1).

The PostgreSQL Administrator's Guide contains more information about
configuring your system for PostgreSQL.


initdb failed.
Removing /usr/local/pgsql/data.

###

Here's what happened:

I removed the old installs of pg (pkg_delete postgresql-7.2.3 && 
pkg_delete postgresql-devel-7.3.rc1 ; this is a FreeBSD box), then 
installed 7.3.  But I did not first stop the postmaster.  Then I ran 
initdb, and the first message was:

###
initdb: The directory /usr/local/pgsql/data exists but is not empty.
If you want to create a new database system, either remove or empty
the directory /usr/local/pgsql/data or run initdb with
an argument other than /usr/local/pgsql/data.
###

So I moved it out of the way: 
# mv  /usr/local/pgsql/data  /usr/local/pgsql/data.old

That's when I encountered the message mentioned in the subject.

The solution involved:

# mv /usr/local/pgsql/data.old /usr/local/pgsql/data
# /usr/local/etc/rc.d/010.pgsql.sh stop
# mv  /usr/local/pgsql/data  /usr/local/pgsql/data.old
# su -l pgsql -c initdb

Then the initdb ran successfully.

-- 
Dan Langille : http://www.langille.org/



Re: 7.4 - TODO : IpcSemaphoreCreate: No space left on

From
Neil Conway
Date:
On Thu, 2002-12-05 at 10:13, Dan Langille wrote:
> This error is accompanied by a suggestion to change SEMMNI or SEMMNS. 
>  In this case, that suggestion is not appropriate.  Read below for 
> the scenario.

> Suggestion: Can we modify the error message to include checking for a 
> running postmaster?

What basically happened is that you were running two copies of the
postmaster at the same time, so you needed enough shared memory +
semaphores for both of them. There's no fundamental difference between
using up all your shared memory with other postmasters, or with other
applications that use shm/semaphores. In either case, the postmaster's
error message is still valid:
   It occurs when either the system limit for the maximum number of   semaphore sets (SEMMNI), or the system wide
maximumnumber of   semaphores (SEMMNS), would be exceeded.  You need to raise the   respective kernel parameter.
 

... although it perhaps doesn't tell the entire truth. Would it be
sufficient to add a note to the documentation about the possibility of
other applications using shared memory / semaphores?

Cheers,

Neil
-- 
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC