Re: Use of ActiveSnapshot

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Use of ActiveSnapshot
Date: 2007-05-14 20:18:47
Message-ID: 4648C427.5010509@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5/14/2007 3:35 PM, Tom Lane wrote:
> Jan Wieck <JanWieck(at)Yahoo(dot)com> writes:
>> The only problem with that is that there are code paths that set
>> ActiveSnapshot to palloc()'d memory that is released due to a
>> MemoryContextDelete() without resetting ActiveSnapshot to NULL.
>
> Only at the very end of a transaction (where ActiveSnapshot *is* reset
> to null, in FreeXactSnapshot); otherwise we'd have bugs unrelated to
> RevalidateCachedPlan. Eventually I would like to have reference-counted
> snapshots managed by a centralized module, as was discussed a month or
> two back; but right at the moment I don't think it's broken and I don't
> want to spend time on intermediate solutions.

Which means that the 8.3 fix for the reproducible backend crash, I
posted earlier, is to have SPI_cursor_open() save and restore
ActiveSnapshot while calling RevalidateCachedPlan(). I'll cross check
that this fixes this symptom and commit later today.

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-05-14 20:26:59 Re: Use of ActiveSnapshot
Previous Message Andrew Dunstan 2007-05-14 20:03:53 Re: What is happening on buildfarm member baiji?