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-20 12:23:30
Message-ID: 20090120122330.GB3940@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:

> > 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.
>
> Well, but production installations don't have either memory clobbering
> or Asserts, so fooling with that wouldn't have helped anyway. I suspect
> what really happened here is that the bug was created by some late
> change during 8.1 development, and nobody ever exercised the
> anti-wraparound code path after that in an assert-enabled build :-(
> In a non-assert build there's a fairly good chance that it'd still
> work because the context header would still be there undamaged.

Well, my builds are all assert-enabled, and I still wasn't able to make
it crash in any way (the new context being allocated in the same
position as the old one is the only explanation I have, but I did not
investigate whether that's what happening). Maybe Greg Stark's idea of
offsetting pointers returned by palloc could have helped to find the
problem from the outset.

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2009-01-20 12:24:47 Re: conexiones ssl
Previous Message Alvaro Herrera 2009-01-20 12:18:39 Re: Autovacuum daemon terminated by signal 11

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2009-01-20 13:50:03 Re: is 8.4 array_agg() supposed to work with array values?
Previous Message Alvaro Herrera 2009-01-20 12:18:39 Re: Autovacuum daemon terminated by signal 11