Re: [PATCH] fix segfault with DO and plperl/plperlu

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alex Hunsaker <badalex(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] fix segfault with DO and plperl/plperlu
Date: 2010-04-18 19:17:39
Message-ID: 25378.1271618259@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alex Hunsaker <badalex(at)gmail(dot)com> writes:
> If you do:
> # DO $do$ 1; $do$ LANGUAGE plperlu;
> # DO $do$ 1; $do$ LANGUAGE plperl;

> You get a segfault as we try to SvREFCNT_dec(...); for the wrong
> interpreter. To fix push down the restore_context() so that we do the
> above on the correct perl interpreter.

Hmm. I don't see a segfault on my machine, but I agree that this looks
bogus. I changed it to this order instead:

if (desc.reference)
SvREFCNT_dec(desc.reference);
current_call_data = save_call_data;
restore_context(oldcontext);

so as to keep the "state restore" operations together.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2010-04-18 20:16:11 Re: testing HS/SR - 1 vs 2 performance
Previous Message Simon Riggs 2010-04-18 18:06:08 pgsql: Tune GetSnapshotData() during Hot Standby by avoiding loop