Re: BUG #8579: CoreDump of background writer process - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #8579: CoreDump of background writer process
Date
Msg-id 27730.1383749433@sss.pgh.pa.us
Whole thread Raw
In response to BUG #8579: CoreDump of background writer process  (rgr@cslab.de)
List pgsql-bugs
rgr@cslab.de writes:
> [ bgwriter crashes here after reporting an error: ]
> (gdb) up
> #1  0x08205ef4 in BackgroundWriterMain () at bgwriter.c:329
> 329     bgwriter.c: No such file or directory.
>         in bgwriter.c
> 329@bgwriter.c: MemoryContextResetAndDeleteChildren(bgwriter_context);
>
> (gdb) print bgwriter_context
> $1 = (MemoryContext) 0x84c0c00
>
> (gdb) print *bgwriter_context
> $3 = {type = T_Invalid, methods = 0x84c0d00, parent = 0x10, firstchild =
> 0x0, nextchild = 0x0, name = 0x0}

The only theory I can think of for that is that the bgwriter_context
local variable wasn't correctly saved and restored by sigsetjmp ...
which IMO would be a compiler bug, but possibly a compiler weenie
would have a different opinion.  What compiler are you using, anyway,
and with what optimization options?

If this theory is correct, attaching "volatile" to the declaration of
bgwriter_context (line 202) ought to work around the problem.  Or
if that doesn't work, mark the variable static.

It'd also be interesting to know if this was the first error reported
by the bgwriter process, or if it successfully recovered from any
previous errors.  (Some trawling of your postmaster log should reveal
this.)  If the latter, it'd suggest there's something funny about
returning to the same sigsetjmp context multiple times; which would
perhaps be a bug worth filing with your OS vendor.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Fwd: Problems with pg_stat_activity view
Next
From: bashtanov@imap.cc
Date:
Subject: BUG #8580: search_path unexpected behavior with pg_temp