Re: crash with assertions and WAL_DEBUG

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: crash with assertions and WAL_DEBUG
Date: 2014-06-21 10:58:49
Message-ID: 53A56569.7040205@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06/15/2014 12:26 AM, Alvaro Herrera wrote:
> Andres Freund wrote:
>> On 2014-06-14 16:57:33 -0400, Tom Lane wrote:
>>> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
>>>> I noticed that HEAD crashes at startup with assertions disabled and
>>>> WAL_DEBUG turned on:
>>>
>>> I'm beginning to think we're going to have to give up on that
>>> no-pallocs-in-critical-sections Assert. It was useful to catch
>>> unnecessarily-dangerous allocations in mainline cases, but getting rid
>>> of every last corner-case palloc is looking to be, if not impossible,
>>> at least a lot more trouble than it is worth.
>>
>> I think we at least need to remove it from 9.4. We shouldn't release
>> with an assertion that still regularly triggers in more or less
>> 'harmless' situations.
>
> Yeah, removing it in 9.4 is likely a good idea -- we have an open item
> about it in connection with LWLOCK_DEBUG, and now this. Who knows what
> other debugging features will cause trouble.

Agreed, I'll remove it from REL9_4_STABLE.

>> I think it might be worthwile to keep it in master to help maintain the
>> rule against allocations in critical sections. And perhaps as a reminder
>> that e.g. the checkpointer is doing bad things...
>
> I also agree with keeping it in 9.5.

Yeah.

Now, to fix the case at hand, the quickest fix would be to allocate the
messages in ErrorContext, which is already exempt from assertion. That's
pretty hacky, though. Tom's suggestion to somehow mark specific pallocs
as OK seems cleaner.

It's a bit difficult to attach the mark to the palloc calls, as neither
the WAL_DEBUG or LWLOCK_STATS code is calling palloc directly, but
marking specific MemoryContexts as sanctioned ought to work. I'll take a
stab at that.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2014-06-21 12:03:18 Re: Window function optimisation, allow pushdowns of items matching PARTITION BY clauses
Previous Message MauMau 2014-06-21 06:45:46 Re: PostgreSQL in Windows console and Ctrl-C