Search Postgresql Archives

Re: [ADMIN] Streaming Replication Server Crash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/23/2012 01:20 PM, Tom Lane wrote:

This isn't the first time I've wondered exactly which signal was meant
in a postmaster child-crash report.  Seems like it might be worth
expending some code on a symbolic translation, instead of just printing
the number.  That'd be easy enough (for common signal names) on Unix,
but has anyone got a suggestion how we might do something useful on
Windows?

Here's a typical Windows exception:


2012-10-04 14:29:08 CEST LOG:  server process (PID 1416) was terminated by exception 0xC0000005

2012-10-04 14:29:08 CEST HINT:  See C include file "ntstatus.h" for a description of the hexadecimal value.


These codes can be translated with FormatMessage:

  http://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx
  http://support.microsoft.com/kb/259693

FormatMessage may not be safe to perform in the context of a munged heap or some other failure conditions, so you probably don't want to do it from a crash handler. It is safe for the postmaster to do it based on the exception code it gets from the dying backend, though.

I'd say the best option is for the postmaster to print the FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_FROM_HMODULE, ...) output when it sees the exception code from the dying backend.

RtlNtStatusToDosError may also be of interest: http://msdn.microsoft.com/en-us/library/windows/desktop/ms680600(v=vs.85).aspx ... but it's in Winternl.h so it's not guaranteed to exist / be compatible between versions and can only be accessed via runtime dynamic linking. Not ideal.

--
Craig Ringer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux