Re: [bug fix] Produce a crash dump before main() on Windows

From: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
To: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [bug fix] Produce a crash dump before main() on Windows
Date: 2018-07-17 13:22:19
Message-ID: CAJrrPGfSXwJLc8LWOkupm-aJ3RcurB5TjhQ=XFG26uQpKJqxnw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 1, 2018 at 4:14 PM Tsunakawa, Takayuki <
tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com> wrote:

> From: Tsunakawa, Takayuki [mailto:tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com]
> > Another idea to add to the current patch is to move the call to
> SetErrorMode()
> > to the below function, which is called first in main(). How about this?
> >
> > void
> > pgwin32_install_crashdump_handler(void)
> > {
> > SetUnhandledExceptionFilter(crashDumpHandler);
> > }
>
> I moved SetErrorMode() to the beginning of main(). It should be placed
> before any code which could crash. The current location is a bit late: in
> fact, write_stderr() crashed when WSAStartup() failed.
>

I reviewed patch and it works as per the subject, but I am not able to
verify the actual
bug that is reported in the upthread. The moving of setErrorMode() call to
the start
of the main function can handle all the cases that can lead to a crash with
no popup.

The reset of setErrorMode(0) before start of any process can generate the
coredump
because of any issue before it reaches the main() function, but this change
can lead
to stop the postmaster restart process, if no one present to observe the
scenario?
Doesn't this change can generate backward compatibility problems to
particular users?

I don't have any other comments with the current patch.

Regards,
Haribabu Kommi
Fujitsu Australia

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2018-07-17 13:28:14 Re: PG 10: could not generate random cancel key
Previous Message Michael Paquier 2018-07-17 13:04:55 Re: PG 10: could not generate random cancel key