Hello,

postgres.exe on Windows doesn't output a crash dump when it crashes before 
main() is called.  The attached patch fixes this.  I'd like this to be 
back-patched.  I'll add this to the next CF.

The original problem happened on our customer's production system.  Their 
application sometimes failed to connect to the database.  That was because 
postgres.exe crashed due to access violation (exception code C0000005).  But 
there was no crash dump, so we had difficulty in finding the cause.  The 
frequency was low -- about ten times during half a year.

What caused the access violation was Symantec's antivirus software.  It seems 
that sysfer.dll of the software intercepts registry access, during C runtime 
library initialization,  before main() is called.  So, the direct cause of this 
problem is not PostgreSQL.

On the other hand, it's PostgreSQL's problem that we can't get the crash dump, 
which makes the investigation difficult.  The cause is that postmaster calls 
SetErrorMode() to disable the outputing of crash dumps by WER (Windows Error 
Reporting).  This error mode is inherited from postmaster to its children.  If 
a crash happens before the child sets up the exception handler, no crash dump 
is produced.


Regards
Takayuki Tsunakawa

Attachment: crash_dump_before_main.patch
Description: crash_dump_before_main.patch

Reply via email to