Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.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