Re: PLTCL return_null crash... - Mailing list pgsql-general

From Joe Conway
Subject Re: PLTCL return_null crash...
Date
Msg-id 3DA273F2.9020203@joeconway.com
Whole thread Raw
In response to Re: PLTCL return_null crash...  ("Nigel J. Andrews" <nandrews@investsystems.co.uk>)
Responses Re: PLTCL return_null crash...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:
> "Nigel J. Andrews" <nandrews@investsystems.co.uk> writes:
>
>>Presumably the fault was removed between 1.48 and 1.49 of src/pl/tcl/pltcl.c
>
>
> But 1.49 is in 7.2.1, which you said you're using?
>

It crashes for me under 7.2.2 and 7.2.3 (but not in 7.3b2). The odd thing is,
even though I compiled --enable-debug, pltcl.so still seems to lack debug symbols:

#0  0x08166774 in pfree (pointer=0x8397450) at mcxt.c:448
#1  0x40028033 in pltcl_func_handler () from /usr/lib/pgsql/pltcl.so
#2  0x40027b8b in pltcl_call_handler () from /usr/lib/pgsql/pltcl.so
#3  0x080c96e0 in ExecMakeFunctionResult (fcache=0x8384728, arguments=0x0,
econtext=0x8384470, isNull=0xbfffebaf "",
     isDone=0xbfffebb0) at execQual.c:825

I tried putting a break in pltcl_func_handler, but here's what I get:

Breakpoint 1, 0x40027bea in pltcl_func_handler () from /usr/lib/pgsql/pltcl.so
(gdb) step
Single stepping until exit from function pltcl_func_handler,
which has no line number information.

Any idea wht I can't step through this? In any case, the problem seems to be
in this section of code:

<snip>
if (SPI_finish() != SPI_OK_FINISH)
   elog(ERROR, "pltcl: SPI_finish() failed");

UTF_BEGIN;
if (fcinfo->isnull)
   retval = (Datum) 0;
else
   retval = FunctionCall3(&prodesc->result_in_func,
                          PointerGetDatum(UTF_U2E(interp->result)),
                          ObjectIdGetDatum(prodesc->result_in_elem),
                          Int32GetDatum(-1));
UTF_END;
</snip>

where:

#define UTF_BEGIN  do { \
   unsigned char *_pltcl_utf_src; \
   unsigned char *_pltcl_utf_dst

#define UTF_END    if (_pltcl_utf_src!=_pltcl_utf_dst) \
   pfree(_pltcl_utf_dst); } while (0)

I was able to step into, and out of, SPI_finish(). The pfree(_pltcl_utf_dst)
seems to be where it is failing.

Joe


pgsql-general by date:

Previous
From: Savita
Date:
Subject: How to find out about index
Next
From: "Shridhar Daithankar"
Date:
Subject: Re: How to find out about index