Thread: Error reporting when hitting shared memory limits -

Error reporting when hitting shared memory limits -

From
Pete Leonard
Date:
Hey folks,

Quick note - in re-compiling the kernel of the box we run Postgres on
(running FreeBSD 3.4), we goofed - SHMMAX was increased, but SHMALL was
not.

If you start up Postgres (7.1.2) and specify a number of buffers greater
than what SHMMAX can provide, you get a nice, useful error message,
detailing what's wrong, and with suggestions on how to fix it.

If you start up Postgres and specify a number of buffers that falls within
the limits of SHMMAX, but exceeds SHMALL, you get an error message like
this:

IpcMemoryCreate: shmget(key=5432001, size=29868032, 03600) failed: Cannot allocate memory

Needless to say, we were a little stumped at first.  :)

Would it be too much to ask for a failure message along the lines of what
exceeding SHMMAX provides?

    thanks,

    --peter



Re: Error reporting when hitting shared memory limits -

From
Tom Lane
Date:
Pete Leonard <pete@hero.com> writes:
> Would it be too much to ask for a failure message along the lines of what
> exceeding SHMMAX provides?

Tell us how to determine that that's what the problem is...

            regards, tom lane

Re: Error reporting when hitting shared memory limits -

From
Peter Eisentraut
Date:
Pete Leonard writes:

> If you start up Postgres (7.1.2) and specify a number of buffers greater
> than what SHMMAX can provide, you get a nice, useful error message,
> detailing what's wrong, and with suggestions on how to fix it.
>
> If you start up Postgres and specify a number of buffers that falls within
> the limits of SHMMAX, but exceeds SHMALL, you get an error message like
> this:
>
> IpcMemoryCreate: shmget(key=5432001, size=29868032, 03600) failed: Cannot allocate memory

The FreeBSD shmget(2) man page does not document this error (ENOMEM).
However, the Linux shmget(2) page says

       ENOMEM      is returned if no memory  could  be  allocated
                   for segment overhead.

which probably means to raise SHMALL.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



Re: Error reporting when hitting shared memory limits -

From
Tom Lane
Date:
Peter Eisentraut <peter_e@gmx.net> writes:
> The FreeBSD shmget(2) man page does not document this error (ENOMEM).
> However, the Linux shmget(2) page says

>        ENOMEM      is returned if no memory  could  be  allocated
>                    for segment overhead.

> which probably means to raise SHMALL.

FWIW, HPUX 10.20 sez

          [ENOMEM]       A shared memory identifier and associated shared
                         memory segment are to be created, but the amount
                         of available physical memory is not sufficient to
                         fill the request.

which implies that you've got to buy more RAM.  But experimentation
indicates that the error is actually delivered only if your request
would overrun available swap space, not physical RAM.  AFAICT this
system does not even have a SHMALL parameter, though it does have a
SHMMAX limit on the size of any one shmem segment.

            regards, tom lane