Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TQXVW-00082v-LO for pgsql-general@postgresql.org; Tue, 23 Oct 2012 05:58:30 +0000 Received: from mail-pa0-f46.google.com ([209.85.220.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TQXVQ-0004vU-3I for pgsql-general@postgresql.org; Tue, 23 Oct 2012 05:58:29 +0000 Received: by mail-pa0-f46.google.com with SMTP id hz1so2501947pad.19 for ; Mon, 22 Oct 2012 22:58:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :x-gm-message-state; bh=U6Gb7pfrBaWSG0ehu0NnCHHNg0DRQ8i7wMlhPUV4/eA=; b=QBQVt31MgbZZA+CAQP1c8/UqVgFye7SNnNGlAT9RWepIrQmeVGBhWxCpbKVMzyTOBH 842qzuD9T8vhvteFginEBl9is/xrtU20bgRB6HFil95Wmz8r6Zqfy4sX6B8NgGJ0AdgV ZJ15NGSLPZjr07lVQRIoa/d9tOxgF7CtEOSZ4X+kciHajFSvAd03HGPMtm6GS8Ngu6le tYAdhzO012vHUsyz4Mss5VkAoxlE3dwxEHjgpIaJoEnMSGF3BJME9POimzzsZtd+jExT tR4YACwyiW7TPiIANSyzld/D4QCs4TkpLNgBYNNb5qkQPo85npntyIDIRjZ9i9t9AwKT RJvw== Received: by 10.68.136.100 with SMTP id pz4mr36637420pbb.135.1350971901974; Mon, 22 Oct 2012 22:58:21 -0700 (PDT) Received: from ayaki.localdomain (office1.postnewspapers.com.au. [150.101.171.128]) by mx.google.com with ESMTPS id nc10sm7157901pbc.17.2012.10.22.22.58.17 (version=SSLv3 cipher=OTHER); Mon, 22 Oct 2012 22:58:19 -0700 (PDT) Message-ID: <508631F7.9040607@ringerc.id.au> Date: Tue, 23 Oct 2012 13:58:15 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 MIME-Version: 1.0 To: Tom Lane CC: raghu ram , pgsql-admin@postgresql.org, pgsql-general Subject: Re: [ADMIN] Streaming Replication Server Crash References: <5084EF7E.5080809@ringerc.id.au> <27094.1350910358@sss.pgh.pa.us> <50862525.5060904@ringerc.id.au> <3067.1350969631@sss.pgh.pa.us> In-Reply-To: <3067.1350969631@sss.pgh.pa.us> X-Enigmail-Version: 1.4.5 Content-Type: multipart/alternative; boundary="------------000402020408050807040308" X-Gm-Message-State: ALoCoQkdIRRs9g04JYCVH/BBzekT6dMgKWY4xNdgRVtOeQNr5Q66CpSmcpa/EzuH0cqQVeGJcBIQ X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201210/679 X-Sequence-Number: 191647 This is a multi-part message in MIME format. --------------000402020408050807040308 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --------------000402020408050807040308 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
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
--------------000402020408050807040308--