RE: [bug fix] Produce a crash dump before main() on Windows - Mailing list pgsql-hackers

From Tsunakawa, Takayuki
Subject RE: [bug fix] Produce a crash dump before main() on Windows
Date
Msg-id 0A3221C70F24FB45833433255569204D1F8D6B1B@G01JPEXMBYT05
Whole thread Raw
In response to Re: [bug fix] Produce a crash dump before main() on Windows  (Craig Ringer <craig@2ndquadrant.com>)
Responses RE: [bug fix] Produce a crash dump before main() on Windows
Re: [bug fix] Produce a crash dump before main() on Windows
Re: [bug fix] Produce a crash dump before main() on Windows
List pgsql-hackers
From: Craig Ringer [mailto:craig@2ndquadrant.com]
> The patch proposed here means that early crashes will invoke WER. If we're
> going to allow WER we should probably just do so unconditionally.
> 
> I'd be in favour of leaving WER on when we find out we're in a noninteractive
> service too, but that'd be a separate patch for pg11+ only.

As for PG11+, I agree that we want to always leave WER on.  That is, call SetErrorMode(SEM_FAILCRITICALERRORS) but not
specifySEM_NOGPFAULTERRORBOX.  The problem with the current specification of PostgreSQL is that the user can only get
crashdumps in a fixed folder $PGDATA\crashdumps.  That location is bad because the crash dumps will be backed up
togetherwith the database cluster without the user noticing it.  What's worse, the crash dumps are large.  With WER,
theuser can control the location and size of crash dumps.
 

> I suggest changing this to a command line flag or environment variable test
> that suppresses Pg's default disabling of WER. A GUC probably doesn't make
> sense; it's too niche, and too early.

As for the past major releases, it's burdensome for the user to have to specify a new flag or an environment variable
whenhe has to get crash dumps to investigate a rare crash before main().  It's not necessary to disable WER for crashes
aftermain() is called, because PG installs an exception handler at the beginning of main(), which works fine.  So can
wego with the current patch?
 

Another idea to add to the current patch is to move the call to SetErrorMode() to the below function, which is called
firstin main().  How about this?
 

void
pgwin32_install_crashdump_handler(void)
{
    SetUnhandledExceptionFilter(crashDumpHandler);
}

Regards
Takayuki Tsunakawa




pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: PlaceHolderVars in pushed down child-join cause error
Next
From: Amit Langote
Date:
Subject: Re: [HACKERS] path toward faster partition pruning