Re: libxml incompatibility

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: David Lee Lambert <davidl(at)lmert(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: libxml incompatibility
Date: 2009-03-09 12:20:50
Message-ID: 49B509A2.1040406@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Lee Lambert wrote:
> On 6 mar, 22:44, and(dot)(dot)(dot)(at)dunslane(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-03-09 12:21:24 Re: problem inserting in GIN index
Previous Message Alvaro Herrera 2009-03-09 12:18:28 problem inserting in GIN index