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

From Tom Lane
Subject Re: Postgresql 8.3 beta crash
Date
Msg-id 26241.1194291013@sss.pgh.pa.us
Whole thread Raw
In response to Re: Postgresql 8.3 beta crash  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> Heikki Linnakangas wrote:
>> It still feels unsafe to call ExecEvalExpr while holding on to xml
>> structs. It means that it's not safe for external modules to use
>> libxml2 and call xmlMemSetup or xmlSetGenericErrorFunc themselves.

> Well yeah, they shouldn't do that.  I don't think we want to support 
> that.

I'm with Heikki that it would be cleaner/safer if we could allow that.
The particular case that's bothering me is the idea that something like
Perl could well try to use libxml internally, and if so it'd very likely
call these functions.  Now if Perl thinks it's got sole control, and
tries to (say) re-use the results of xmlInitParser across calls, we're
screwed anyway.  But that's not an argument for designing our own code
in a way that guarantees it can't share libxml with other code.

So I'm thinking that we should continue to call xmlMemSetup,
xmlSetGenericErrorFunc, and xmlInitParser (if needed) at the start of
every XML function, and reorganize the code so that we don't call out
to random other code until we've shut down libxml again.

The main disadvantage I can see of reorganizing like that is that
it will increase xmlelement's transient memory consumption, since it
will need to accumulate all the OutputFunctionCall result strings
before it starts to pass them to libxml.  This probably isn't a huge
problem though.

Has anyone started actively working on this yet?  If not, I can tackle
it.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pg 8.3beta 2 restore db with autovacuum report
Next
From: Tom Lane
Date:
Subject: Re: Is necessary to use SEQ_MAXVALUE in pg_dump?