Re: shared memory after server kill

Поиск
Список
Период
Сортировка
От Oliver Fromme
Тема Re: shared memory after server kill
Дата
Msg-id 200408051106.i75B69lO088473@lurza.secnetix.de
обсуждение исходный текст
Ответ на shared memory after server kill  (Sean Davis <sdavis2@mail.nih.gov>)
Ответы Re: shared memory after server kill  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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.

В списке pgsql-novice по дате отправления:

Предыдущее
От: Sean Davis
Дата:
Сообщение: Re: shared memory after server kill
Следующее
От: Tom Lane
Дата:
Сообщение: Re: shared memory after server kill