Re: MemoryContextSwitchTo (Re: [GENERAL] Autovacuum daemon terminated by signal 11)

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Simon Riggs <simon(at)2ndQuadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: MemoryContextSwitchTo (Re: [GENERAL] Autovacuum daemon terminated by signal 11)
Date: 2009-01-17 17:15:46
Message-ID: 20090117171546.GJ12449@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Tom Lane wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> > Can we add something to memory contexts to make this fail every time?
>
> No, not really. AFAICS the reason for Alvaro not seeing it must be that
> on his machine the new transaction happens to allocate its
> TopTransactionContext control block right in the same place where the
> old one was.

But freed memory is clobbered, so if we were to have an assert that
checks the node tag, it should show up. In fact, we do have such an
assert, but only for compilers other than GCC, because the inline
version of palloc() cannot have it for lack of infrastructure.

Maybe we should patch palloc.h so that it only uses the inline version
when not in assert mode. Something like the attached, except that for
some reason the test case still fails to report any error for me :-(
Maybe the cpp boolean logic is fooling me.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment Content-Type Size
palloc-inline.patch text/x-diff 1.7 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2009-01-17 17:41:31 Re: executing a sql script
Previous Message Simon Riggs 2009-01-17 17:01:28 Re: MemoryContextSwitchTo (Re: [GENERAL] Autovacuum daemon terminated by signal 11)

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2009-01-17 17:55:20 Re: MemoryContextSwitchTo (Re: [GENERAL] Autovacuum daemon terminated by signal 11)
Previous Message Simon Riggs 2009-01-17 17:01:28 Re: MemoryContextSwitchTo (Re: [GENERAL] Autovacuum daemon terminated by signal 11)