Re: codlin_month is up and complain - PL/Python crash

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: codlin_month is up and complain - PL/Python crash
Date: 2010-02-17 16:15:50
Message-ID: 1266423350.3539.10.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On ons, 2010-02-17 at 11:05 -0500, Tom Lane wrote:
> All of the MemoryContextSwitchTo calls in plpython seem to be in
> patterns like this:
>
> MemoryContext oldcontext;
>
> oldcontext = CurrentMemoryContext;
> PG_TRY();
> {
> ... do something ...
> }
> PG_CATCH();
> {
> MemoryContextSwitchTo(oldcontext);
>
> Since oldcontext is only set in the one place, it really shouldn't
> require "volatile" decoration, but maybe it does.

It is my understanding that local automatic variables may be clobbered
by [sig]longjmp unless they are marked volatile. The PG_CATCH branch is
reached by means of a [sig]longjmp. So that would mean that any
variable that you want to use both before the TRY and inside the CATCH
has to be volatile.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-02-17 16:26:00 Re: codlin_month is up and complain - PL/Python crash
Previous Message Tom Lane 2010-02-17 16:05:36 Re: codlin_month is up and complain - PL/Python crash