Re: Postgresql 8.3 beta crash - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Postgresql 8.3 beta crash
Date
Msg-id 5341.1193929013@sss.pgh.pa.us
Whole thread Raw
In response to Re: Postgresql 8.3 beta crash  (Heikki Linnakangas <heikki@enterprisedb.com>)
Responses Re: Postgresql 8.3 beta crash  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Heikki Linnakangas <heikki@enterprisedb.com> writes:
> Tom Lane wrote:
>> I think that (1) we need a call to xml_init here, and hence also a
>> PG_TRY block; 

> xml_init doesn't actually do anything that would need to be free'd in 
> case of error. But yeah, it does seem like a good idea to free the "text 
> writer" and "xml buffer" allocated at the beginning of xmlelement(). 
> They should be allocated by xml_palloc in the current memory context, 
> though, and freed by the memory context reset as usual, but apparently 
> we don't trust that for xml document or dtd objects either.

Well, xml_init calls xmlInitParser() which needs to be cleaned up.
But since xmlelement doesn't need that, maybe we should factor it
out of xml_init.

As for the try/catch blocks instead of relying on memory context
cleanup, I'm not entirely sure if that's still needed or if it's a
hangover from before we understood how to use xmlMemSetup.  The note
at line 27ff of xml.c implies that libxml keeps static pointers to
allocated things that it thinks will survive indefinitely, so we
may have to have these.  I'm suspicious whether xmlelement doesn't
have a problem if the called expressions error out ...

Peter, any comment on this stuff?
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Hiroshi Saito"
Date:
Subject: Calculation of a shared memory
Next
From: Camilo Porto
Date:
Subject: Re: URGENT HELP about 'duration' stats