Re: MemoryContextSwitchTo (Re: [GENERAL] Autovacuum daemon terminated by signal 11) - Mailing list pgsql-hackers

Simon Riggs <simon@2ndQuadrant.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.

We could have a debugging mode in which pfree'd space is never recycled
for reuse (just filled with 0xdeadbeef or whatever and left to sit).
But it would not be practical for anything except short debugging
sessions.  In fact, for a case like this, only *very* short debugging
sessions, because you couldn't even recycle after transaction commit.
So the chance of finding problems in seldom-exercised code paths, as
this one is, would be pretty small anyway.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Brendan Jurd"
Date:
Subject: Re: pg_dump versus views and opclasses
Next
From: Simon Riggs
Date:
Subject: Re: MemoryContextSwitchTo (Re: [GENERAL] Autovacuum daemon terminated by signal 11)