pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142
4+ messages / 3 participants
[nested] [flat]

* BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142
@ 2011-09-09 20:59 Jerome Schulteis <jerome.schulteis@edstrom.com>
  2011-09-10 00:53 ` Re: BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142 Craig Ringer <ringerc@ringerc.id.au>
  0 siblings, 1 reply; 4+ messages in thread

From: Jerome Schulteis @ 2011-09-09 20:59 UTC (permalink / raw)
  To: 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.



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142
  2011-09-09 20:59 BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142 Jerome Schulteis <jerome.schulteis@edstrom.com>
@ 2011-09-10 00:53 ` Craig Ringer <ringerc@ringerc.id.au>
  2011-09-12 15:02   ` Re: BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142 Jerome Schulteis <Jerome.Schulteis@edstrom.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Craig Ringer @ 2011-09-10 00:53 UTC (permalink / raw)
  To: Jerome Schulteis <jerome.schulteis@edstrom.com>; +Cc: pgsql-bugs

On 10/09/2011 4:59 AM, Jerome Schulteis wrote:
> 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):
I wonder which DLL failed? It seems that PostgreSQL doesn't print the 
message the operating system generates for these errors. For example, it 
should be printing:

"{DLL Initialization Failed} Initialization of the dynamic link library 
%hs failed. The process is terminating abnormally."

... where %hs is the DLL name or path. I should have a play with that 
once I finish moving house...



Do you have any antivirus or antimalware products on the system?

Do you have a Logitech webcam? Their webcam effects app adds a hook DLL 
to every process on the system, and I've seen it cause issues with MinGW 
among other things before.

If you launch a trivial process like "notepad.exe" then launch Process 
Explorer from SysInternals, select notepad.exe and press control-D to 
show the DLL list, what non-Microsoft DLLs are shown? You can copy and 
paste the list.

If you examine a running postgres.exe backend (one of the processess 
listed UNDER the main "postgres.exe" which is the postmaster) the same 
way, what non-Microsoft DLLs are shown there? Note that you may have to 
run Process Explorer as administrator to view the DLL list for 
postgres.exe. Ignore any DLLs ending in ".NLS" .

For bonus points, verify each Microsoft DLL as having a valid signature 
by double-clicking on it in the list, and report any DLLs that fail 
verification.



--
Craig Ringer




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142
  2011-09-09 20:59 BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142 Jerome Schulteis <jerome.schulteis@edstrom.com>
  2011-09-10 00:53 ` Re: BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142 Craig Ringer <ringerc@ringerc.id.au>
@ 2011-09-12 15:02   ` Jerome Schulteis <Jerome.Schulteis@edstrom.com>
  2011-09-13 04:54     ` Re: BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142 Craig Ringer <ringerc@ringerc.id.au>
  0 siblings, 1 reply; 4+ messages in thread

From: Jerome Schulteis @ 2011-09-12 15:02 UTC (permalink / raw)
  To: Craig Ringer <ringerc@ringerc.id.au>; +Cc: pgsql-bugs

> From: Craig Ringer [mailto:ringerc@ringerc.id.au]
> Sent: Friday, September 09, 2011 7:53 PM
> 
> On 10/09/2011 4:59 AM, Jerome Schulteis wrote:
> > 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):
> I wonder which DLL failed? It seems that PostgreSQL doesn't print the
> message the operating system generates for these errors. For example, it
> should be printing:
> 
> "{DLL Initialization Failed} Initialization of the dynamic link library %hs failed.
> The process is terminating abnormally."
> 
> ... where %hs is the DLL name or path. I should have a play with that once I
> finish moving house...
> 
> 
> Do you have any antivirus or antimalware products on the system?

This was on a VirtualBox VM with no antivirus; originally seen on a real machine running ESET 4.0.
 
> Do you have a Logitech webcam? Their webcam effects app adds a hook DLL
> to every process on the system, and I've seen it cause issues with MinGW
> among other things before.

There is no webcam on the system.

> If you launch a trivial process like "notepad.exe" then launch Process
> Explorer from SysInternals, select notepad.exe and press control-D to
> show the DLL list, what non-Microsoft DLLs are shown? You can copy and
> paste the list.

All of the DLLs for notepad.exe are either Microsoft or .nls.

> If you examine a running postgres.exe backend (one of the processess
> listed UNDER the main "postgres.exe" which is the postmaster) the same
> way, what non-Microsoft DLLs are shown there? Note that you may have to
> run Process Explorer as administrator to view the DLL list for
> postgres.exe. Ignore any DLLs ending in ".NLS" .
> 
> For bonus points, verify each Microsoft DLL as having a valid signature
> by double-clicking on it in the list, and report any DLLs that fail
> verification.

All Microsoft DLLs verified. The following are all of the non-Microsoft non-.nls DLLs:

iconv.dll	LGPLed libiconv for Windows NT/2000/XP and Windows 95/98/ME	Free Software Foundation	1.9.0.0
libeay32.dll	OpenSSL Shared Library	The OpenSSL Project, http://www.openssl.org/	0.9.8.12
libiconv-2.dll	LGPLed libiconv for Windows NT/2000/XP/Vista and Windows 95/98/ME	Free Software Foundation	1.12.0.0
libintl-8.dll	LGPLed libintl for Windows NT/2000/XP/Vista and Windows 95/98/ME	Free Software Foundation	0.17.0.0
libxml2.dll			
postgres.exe	PostgreSQL Server	PostgreSQL Global Development Group	9.0.4.11104
ssleay32.dll	OpenSSL Shared Library	The OpenSSL Project, http://www.openssl.org/	0.9.8.12
zlib1.dll	zlib data compression library		1.2.3.0

> --
> Craig Ringer

Thanks for looking into this.


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142
  2011-09-09 20:59 BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142 Jerome Schulteis <jerome.schulteis@edstrom.com>
  2011-09-10 00:53 ` Re: BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142 Craig Ringer <ringerc@ringerc.id.au>
  2011-09-12 15:02   ` Re: BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142 Jerome Schulteis <Jerome.Schulteis@edstrom.com>
@ 2011-09-13 04:54     ` Craig Ringer <ringerc@ringerc.id.au>
  0 siblings, 0 replies; 4+ messages in thread

From: Craig Ringer @ 2011-09-13 04:54 UTC (permalink / raw)
  To: Jerome Schulteis <Jerome.Schulteis@edstrom.com>; +Cc: pgsql-bugs

On 12/09/2011 11:02 PM, Jerome Schulteis wrote:
>
> For bonus points, verify each Microsoft DLL as having a valid signature
> by double-clicking on it in the list, and report any DLLs that fail
> verification.
> All Microsoft DLLs verified. The following are all of the non-Microsoft non-.nls DLLs:
>
> iconv.dll	LGPLed libiconv for Windows NT/2000/XP and Windows 95/98/ME	Free Software Foundation	1.9.0.0
> libeay32.dll	OpenSSL Shared Library	The OpenSSL Project, http://www.openssl.org/	0.9.8.12
> libiconv-2.dll	LGPLed libiconv for Windows NT/2000/XP/Vista and Windows 95/98/ME	Free Software Foundation	1.12.0.0
> libintl-8.dll	LGPLed libintl for Windows NT/2000/XP/Vista and Windows 95/98/ME	Free Software Foundation	0.17.0.0
> libxml2.dll			
> postgres.exe	PostgreSQL Server	PostgreSQL Global Development Group	9.0.4.11104
> ssleay32.dll	OpenSSL Shared Library	The OpenSSL Project, http://www.openssl.org/	0.9.8.12
> zlib1.dll	zlib data compression library		1.2.3.0

Damn, scratch that theory. It's not a buggy hook DLL with some kind of race.

Maybe this exists in the standard Pg distribution and people don't 
usually hit it because there aren't usually user logon/logoff events on 
most database servers while they're doing work? Or people who've noticed 
it have never bothered to track it down and isolate it until you did?

It sounds like you've tested this on a clean Windows install in a VM, yes?

The next step would be to figure out which DLL's InitInstance() or 
ExitInstance() is failing, and how to get the postmaster to print the 
formatted version of that error so we can see the substitutions in the 
message string. I'm not able to take that on right now as I'm behind on 
my main work and moving house as well.

Is anyone willing to volunteer to dig into this one?

--
Craig Ringer



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2011-09-13 04:54 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-09-09 20:59 BUG #6201: Windows User Log Off Causes Backend Exception 0xC0000142 Jerome Schulteis <jerome.schulteis@edstrom.com>
2011-09-10 00:53 ` Craig Ringer <ringerc@ringerc.id.au>
2011-09-12 15:02   ` Jerome Schulteis <Jerome.Schulteis@edstrom.com>
2011-09-13 04:54     ` Craig Ringer <ringerc@ringerc.id.au>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox