Re: Elusive segfault with 9.3.5 & query cancel

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Elusive segfault with 9.3.5 & query cancel
Date: 2014-12-05 22:11:16
Message-ID: CAM3SWZQHJu8x0aTeqE6g99AJsM1iG0Bb9Y8TH-gAjSA77oghbA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 5, 2014 at 1:29 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
>> We made some changes which decreased query cancel (optimizing queries,
>> turning on hot_standby_feedback) and we haven't seen a segfault since
>> then. As far as the user is concerned, this solves the problem, so I'm
>> never going to get a trace or a core dump file.
>
> Forgot a major piece of evidence as to why I think this is related to
> query cancel: in each case, the segfault was preceeded by a
> multi-backend query cancel 3ms to 30ms beforehand. It is possible that
> the backend running the query which segfaulted might have been the only
> backend *not* cancelled due to query conflict concurrently.
> Contradicting this, there are other multi-backend query cancels in the
> logs which do NOT produce a segfault.

I wonder if it would be useful to add additional instrumentation so
that even without a core dump, there was some cursory information
about the nature of a segfault.

Yes, doing something with a SIGSEGV handler is very scary, and there
are major portability concerns (e.g.
https://bugs.ruby-lang.org/issues/9654), but I believe it can be made
robust on Linux. For what it's worth, this open source project offers
that kind of functionality in the form of a library:
https://github.com/vmarkovtsev/DeathHandler

--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Adam Brightwell 2014-12-05 22:21:09 Re: Role Attribute Bitmask Catalog Representation
Previous Message Josh Berkus 2014-12-05 21:29:31 Re: Elusive segfault with 9.3.5 & query cancel