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: 20021031201831.GB316@tishler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin pgsql-hackers

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 Content-Type Size
shm.c.diff text/plain 446 bytes

In response to

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

Responses

Browse pgsql-cygwin by date

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

Browse pgsql-hackers by date

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