BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142 - Mailing list pgsql-bugs

From Jerome Schulteis
Subject BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142
Date
Msg-id 201109092059.p89KxoVr078697@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142  (Craig Ringer <ringerc@ringerc.id.au>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      6201
Logged by:          Jerome Schulteis
Email address:      jerome.schulteis@edstrom.com
PostgreSQL version: 9.0.4
Operating system:   Windows XP Pro SP3
Description:        Windows User Log Off Causes Backend Exception 0xC0000142
Details:

It does not happen on every log off, but if the Windows console user logs
off
of the server at just the wrong time while a backend is starting up, the
backend terminates with exception 0xC0000142 (STATUS_DLL_INIT_FAILED), and
the
PostgreSQL Windows service stops (shared memory block is still in use):

2011-09-09 10:34:01 CDT LOG:  server process (PID 3260) was terminated by
exception 0xC0000142
2011-09-09 10:34:01 CDT HINT:  See C include file "ntstatus.h" for a
description of the hexadecimal value.
2011-09-09 10:34:01 CDT LOG:  terminating any other active server processes
[...]
2011-09-09 10:34:02 CDT WARNING:  terminating connection because of crash of
another server process
2011-09-09 10:34:02 CDT 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.
2011-09-09 10:34:02 CDT HINT:  In a moment you should be able to reconnect
to the database and repeat your command.
2011-09-09 10:34:02 CDT LOG:  all server processes terminated;
reinitializing
2011-09-09 10:34:12 CDT FATAL:  pre-existing shared memory block is still in
use
2011-09-09 10:34:12 CDT HINT:  Check if there are any old server processes
still running, and terminate them.

Originally encountered with our web app running a stress test on PostgreSQL
8.4.2; I reproduced it on a default one-click install of 9.0.4.  I run the
following Java on a separate machine to get a new connection every 100 ms:

class ConnectionHog {
    static public void main(String[] args) {
        try {
            while (true) {
                java.sql.DriverManager.getConnection(args[0], args[1],
args[2]);
                Thread.sleep(Long.parseLong(args[3]));
            }
        }
        catch (Throwable t) {
            System.err.println(t);
        }
    }
}

I then log on and off the server from a separate user account (that is, not
the postgres
account); the error shows up after at most 3 log offs. As long as no log
offs happen on the server, no problem.

pgsql-bugs by date:

Previous
From: Simon Riggs
Date:
Subject: Re: BUG #6200: standby bad memory allocations on SELECT
Next
From: Craig Ringer
Date:
Subject: Re: BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142