pre-existing shared memory block is still in use after crashes - Mailing list pgsql-general

From Dave Vitek
Subject pre-existing shared memory block is still in use after crashes
Date
Msg-id 4BE2D5D2.6040400@grammatech.com
Whole thread Raw
Responses Re: pre-existing shared memory block is still in use after crashes  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-general
Hi all,

Yesterday I ran into two backend crashes and then an autovacuum launcher
process crash.  The autovacuum log was:
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher process (PID 3788) was terminated by exception
0xC0000142
HINT:  See C include file "ntstatus.h" for a description of the
hexadecimal value.
LOG:  terminating any other active server processes
LOG:  all server processes terminated; reinitializing
FATAL:  pre-existing shared memory block is still in use
HINT:  Check if there are any old server processes still running, and
terminate them.


The others both looked like this:
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
LOG:  incomplete startup packet
LOG:  server process (PID 1384) was terminated by exception 0xC0000142
HINT:  See C include file "ntstatus.h" for a description of the
hexadecimal value.
LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back
the current transaction and exit, because another server process exited
abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and
repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back
the current transaction and exit, because another server process exited
abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and
repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back
the current transaction and exit, because another server process exited
abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and
repeat your command.
LOG:  all server processes terminated; reinitializing
FATAL:  pre-existing shared memory block is still in use
HINT:  Check if there are any old server processes still running, and
terminate them.


The version is 8.4.2-1.  This is a fairly clean windows XP SP3 machine
without any antivirus software.

The machine was running two separate postmasters using the same
installation and they had both been chugging along for a while.  A third
unrelated non-postgres job started that turned out to be a memory hog.
The two "server processes" crashed within 5 minutes of one another,
possibly at the very same time.  The autovacuum crash happened shortly
thereafter on a brand new postmaster during startup.

We believe the machine was under memory pressure and that's what caused
this problem (i.e., windows couldn't load the dlls because it didn't
have memory).  It looks like postgres is already trying to do something
not-completely-fatal, but fails to restart because of this "pre-existing
shared memory block is still in use" error?  Any idea what's going on
there?  I know sometimes windows takes a little extra time to
acknowledge that a resource has been released, so it wouldn't surprise
me if sleeping a little and trying again worked.  I know for a fact this
approach is often necessary on the file system (if you call
CreateFile/CloseHandle and DeleteFile in rapid succession on the same
name, some failures can arise).

- Dave



pgsql-general by date:

Previous
From: Thom Brown
Date:
Subject: Re: I need to take metadata from a shell script.
Next
From: Scott Mead
Date:
Subject: Re: I need to take metadata from a shell script.