Re: ipc-daemon - Mailing list pgsql-cygwin

From Jason Tishler
Subject Re: ipc-daemon
Date
Msg-id 20021031201831.GB316@tishler.net
Whole thread Raw
In response to ipc-daemon  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: ipc-daemon  (Jason Tishler <jason@tishler.net>)
Re: ipc-daemon  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-cygwin
Peter,

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
       EACCES.
    2. This causes PostgreSQL's InternalIpcMemoryCreate() to return
       NULL.
    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.

Jason

Attachment

pgsql-cygwin by date:

Previous
From: Jason Tishler
Date:
Subject: Re: Cygwin: ip-daemon install service problem
Next
From: Jason Tishler
Date:
Subject: Re: Problem configuring Postgres under Cygwin