Re: libxml incompatibility - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: libxml incompatibility
Date
Msg-id 49B509A2.1040406@dunslane.net
Whole thread Raw
In response to Re: libxml incompatibility  (David Lee Lambert <davidl@lmert.com>)
Responses Re: libxml incompatibility  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

David Lee Lambert wrote:
> On 6 mar, 22:44, and...@dunslane.net (Andrew Dunstan) wrote:
>   
>> Holger Hoffstaette wrote:
>>     
>>> On Fri, 06 Mar 2009 14:32:25 -0600, Kenneth Marshall wrote:
>>>       
>>>> On Fri, Mar 06, 2009 at 02:58:30PM -0500, Andrew Dunstan wrote:
>>>>         
>>>>> Yes, I discovered this a few weeks ago. [...]
>>>>>           
>> Maybe someone can trace the libxml calls ... not sure how exactly ...
>> given Alvaro's example, it doesn't seem likely to me that this is due to
>> a call to xmlCleanupParser(), but maybe the perl code invokes by simply
>> doing "use XML::LibXML;" calls that for some perverse reason.
>>     
>
> I'm able to duplicate this on Postgres 8.4 (Debian Etch, XML::LibXML
> from CPAN).  Here's the backtrace from the crash:
>
> #0  0x082f3cf1 in MemoryContextAlloc ()
> #1  0x082c3f8a in xml_palloc ()
> #2  0xb7dfa548 in xmlInitCharEncodingHandlers () from /usr/lib/
> libxml2.so.2
> #3  0xb7e0195e in xmlInitParser () from /usr/lib/libxml2.so.2
> #4  0xb7dff2ef in xmlCheckVersion () from /usr/lib/libxml2.so.2
> #5  0xb573af2e in boot_XML__LibXML ()
>    from /usr/local/lib/perl/5.8.8/auto/XML/LibXML/LibXML.so
> #6  0xb587981b in Perl_pp_entersub () from /usr/lib/libperl.so.5.8
> #7  0xb5877f19 in Perl_runops_standard () from /usr/lib/libperl.so.5.8
> #8  0xb5819b6e in Perl_magicname () from /usr/lib/libperl.so.5.8
> #9  0xb581a844 in Perl_call_sv () from /usr/lib/libperl.so.5.8
> ...
>
> Is it supposed to be OK to call xmlCheckVersion() more than once?
>
>
>   

You are certainly not supposed to call xmlInitParser more than once - 
see <http://xmlsoft.org/html/libxml-parser.html#xmlInitParser>

Since this is being called by xmlCheckVersion(), that looks like a bug 
in libxml2.

Even if this were fixed, however, I'm still not convinced that we'll be 
able to call libxml2 from perl after we've installed our memory handler 
(xml_palloc).

cheers

andrew


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: problem inserting in GIN index
Next
From: Tom Lane
Date:
Subject: Re: problem inserting in GIN index