Re: shared memory after server kill

From: Oliver Fromme <olli(at)lurza(dot)secnetix(dot)de>
To: sdavis2(at)mail(dot)nih(dot)gov (Sean Davis)
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: shared memory after server kill
Date: 2004-08-05 11:06:09
Message-ID: 200408051106.i75B69lO088473@lurza.secnetix.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


Sean Davis wrote:
> I am using macosx, pg 7.4.3. I had a server running and working. I
> tried to bring the server down with 'pg_ctl stop', which failed (server
> running on localhost). I then (timidly) killed the postmaster process.
>
> When I tried to bring the server back up, I got an error similar to:
>
> FATAL: could not create shared memory segment: Cannot allocate memory
> DETAIL: Failed system call was shmget(key=1, size=1081344, 03600).
> [...]
> I have 4 Gb of memory, with approximately 2.6 Gb available (via top)
> and a vast swap. What is going on?

When you kill the postmaster process forcibly, it doesn't
release the shared memory segments that it had allocated.

Use the "ipcs" command to list all currently allocated
shared memory segments, and use "ipcrm" to remove them.
I've once written a small shell script which basically
does it (I've only tested it on FreeBSD, but Mac OS X
should be similar enough):

#!/bin/sh -
ipcs | awk '($1=="m"){print $2}' | xargs -n 1 -t ipcrm -m

Of course, you can also solve the problem the Windows way
(i.e. reboot). ;-)

Best regards
Oliver

--
Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

With Perl you can manipulate text, interact with programs, talk over
networks, drive Web pages, perform arbitrary precision arithmetic,
and write programs that look like Snoopy swearing.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2004-08-05 14:17:05 Re: shared memory after server kill
Previous Message Sean Davis 2004-08-05 10:47:17 Re: shared memory after server kill