Re: BUG #8579: CoreDump of background writer process

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: rgr(at)cslab(dot)de
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8579: CoreDump of background writer process
Date: 2013-11-06 14:50:33
Message-ID: 27730.1383749433@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

rgr(at)cslab(dot)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(at)bgwriter(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2013-11-06 15:44:31 Re: BUG #8579: CoreDump of background writer process
Previous Message Kevin Grittner 2013-11-06 14:28:55 Re: Fwd: Problems with pg_stat_activity view