Skip site navigation (1) Skip section navigation (2)

Re: ipc-daemon

From: Jason Tishler <jason(at)tishler(dot)net>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: ipc-daemon
Date: 2002-10-31 20:18:31
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-cygwinpgsql-hackers

On Wed, Oct 30, 2002 at 08:35:41PM +0100, Peter Eisentraut wrote:
> I'm getting tired of the "initdb hangs" class of complaints.  Why
> doesn't the relevant function fail if the ipc-daemon isn't running?
> Can anything be done in that area?

It is usually more productive to debug and/or provide a patch than to
complain.  Remember, this is open source and not proprietary software.
If you have the itch, then scratch it.

Nevertheless, I have debugged the root cause of this problem:

    1. If ipc-daemon is not running, then cygipc's shmget() will return
    2. This causes PostgreSQL's InternalIpcMemoryCreate() to return
    3. This causes PostgreSQL's PGSharedMemoryCreate() to spin looking
       for accessible shared memory which it will never find.

With the attached cygipc patch (against cygipc 1.11-1), postmaster fails
when ipc-daemon is not running as follows:

    $ postmaster -D /usr/share/postgresql/data
    IpcMemoryCreate: shmget(key=5432001, size=1441792, 03600) failed: No space left on device

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

    It occurs either if all available shared memory IDs have been taken,
    in which case you need to raise the SHMMNI parameter in your kernel,
    or because the system's overall limit for shared memory has been
    reached.  If you cannot increase the shared memory limit,
    reduce PostgreSQL's shared memory request (currently 1441792 bytes),
    by reducing its shared_buffers parameter (currently 64) and/or
    its max_connections parameter (currently 32).

    The PostgreSQL Administrator's Guide contains more information about
    shared memory configuration.

Is the above an acceptable solution?

After reading the shmget() man page, I choose to return ENOSPC.  Is
there a better choice?  Such as ENOMEM?

Note that I'm not very knowledgeable in the area of shared memory and
can use some help determining the best error to return when ipc-daemon
is not running.

Once we reach consensus on the above, I will submit a patch to the
cygipc maintainer.  Unfortunately, he is currently defending his Ph.D
thesis and has indicated that he will not deal with Cygwin issues until
he is finished.


Attachment: shm.c.diff
Description: text/plain (446 bytes)

In response to

  • ipc-daemon at 2002-10-30 19:35:41 from Peter Eisentraut


pgsql-cygwin by date

Next:From: Jason TishlerDate: 2002-10-31 20:20:49
Subject: Re: Problem configuring Postgres under Cygwin
Previous:From: Jason TishlerDate: 2002-10-31 19:51:34
Subject: Re: Cygwin: ip-daemon install service problem

pgsql-hackers by date

Next:From: Rod TaylorDate: 2002-10-31 20:23:08
Subject: Re: 7.2.3 vacuum bug
Previous:From: Robert E. BruccoleriDate: 2002-10-31 19:44:42
Subject: Re: Test of PG7.3.2b2 on SGI Irix

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group