Re: bgworker crashed or not?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Antonin Houska <antonin(dot)houska(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bgworker crashed or not?
Date: 2014-04-16 16:04:26
Message-ID: CA+TgmoZe4zqRAX8rgpy9UWy=PE7=3B_1J34bTehEi25hCgr3kw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 16, 2014 at 12:00 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> On 2014-04-16 11:54:25 -0400, Tom Lane wrote:
>> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
>> > On 2014-04-16 11:37:47 -0400, Robert Haas wrote:
>> >> Why can't that be handled through ereport(ERROR/FATAL) rather than
>> >> through the choice of exit status?
>>
>> > I dislike that because it essentially requires the bgworker to have a
>> > full error catching environment like PostgresMain() has. That seems
>> > bad for many cases.
>>
>> That sounds like utter nonsense. No sane bgwriter code is going to be
>> able to discount the possibility of something throwing an elog(ERROR).
>> Now, you might not need the ability to do a transaction abort, but
>> you'll have to at least be able to terminate the process cleanly.
>
> Why? Throwing an error without an exception stack seems to work
> sensibly? The error is promoted to FATAL and the normal FATAL handling
> is performed? C.f. pg_re_throw() called via errfinish() in the ERRROR
> case.

And... so what's the problem? You seemed to be saying that the
background worker would need to a more developed error-handling
environment in order to do proper logging, but here you're saying
(rightly, I believe) that it doesn't. Even if it did, though, I think
the right solution is to install one, not make it the postmaster's job
to try to read the tea leaves in the worker's exit code.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-04-16 16:08:44 Re: Dynamic Shared Memory stuff
Previous Message Robert Haas 2014-04-16 16:01:36 Re: PostgreSQL in Windows console and Ctrl-C