Skip Menu |

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 30610
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: ROBINS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.58
Fixed in: (no value)



Subject: XML::LibXML::Node::DESTROY causes segfault under mod_perl2
The problem is also described here: http://www.perlmonks.org/?node_id=649745 To me it looks like the cleanup at the end of the request does something wrong, but I'm not exactly sure where to look. Is this a libxml bug, or a mod_perl concurrency/thread issue (using prefork mpm in apache2). XML-LibXML v1.58 Perl v5.8.7 built for i486-linux-gnu-thread-multi Linux gm 2.6.15-29-686 #1 SMP PREEMPT Mon Sep 24 17:24:47 UTC 2007 i686 GNU/Linux (Ubuntu 6.06) Apache 2.0.55-4ubuntu2.2 mod_perl 2.0.2-2ubuntu1.6.06.1 Trace: #0 0xb7699e5e in xmlDictOwns () from /usr/lib/libxml2.so.2 #1 0xb75fe790 in xmlFreeNodeList () from /usr/lib/libxml2.so.2 #2 0xb75fe734 in xmlFreeNodeList () from /usr/lib/libxml2.so.2 #3 0xb75fe734 in xmlFreeNodeList () from /usr/lib/libxml2.so.2 #4 0xb75fe8fa in xmlFreeNode () from /usr/lib/libxml2.so.2 #5 0xb75b3305 in PmmFreeNode () from /usr/lib/perl5/auto/XML/LibXML/LibXML.so #6 0xb75b33fd in PmmREFCNT_dec () from /usr/lib/perl5/auto/XML/LibXML/LibXML.so #7 0xb75b33df in PmmREFCNT_dec () from /usr/lib/perl5/auto/XML/LibXML/LibXML.so #8 0xb75981aa in XS_XML__LibXML__Node_DESTROY () from /usr/lib/perl5/auto/XML/LibXML/LibXML.so #9 0xb786d3b9 in Perl_pp_entersub () from /usr/lib/libperl.so.5.8 #10 0xb7804f10 in Perl_get_cv () from /usr/lib/libperl.so.5.8 #11 0xb7808cf1 in Perl_call_sv () from /usr/lib/libperl.so.5.8 #12 0xb7870079 in Perl_sv_clear () from /usr/lib/libperl.so.5.8 #13 0xb7870922 in Perl_sv_free () from /usr/lib/libperl.so.5.8 #14 0xb787039a in Perl_sv_clear () from /usr/lib/libperl.so.5.8 #15 0xb7870922 in Perl_sv_free () from /usr/lib/libperl.so.5.8 #16 0xb7895052 in Perl_free_tmps () from /usr/lib/libperl.so.5.8 #17 0xb7865a1e in Perl_pp_nextstate () from /usr/lib/libperl.so.5.8 #18 0xb7865917 in Perl_runops_standard () from /usr/lib/libperl.so.5.8 #19 0xb7804ef0 in Perl_get_cv () from /usr/lib/libperl.so.5.8 #20 0xb7808cf1 in Perl_call_sv () from /usr/lib/libperl.so.5.8 #21 0xb7918b7f in modperl_callback () from /usr/lib/apache2/modules/mod_perl.so #22 0xb7919451 in modperl_callback_run_handlers () from /usr/lib/apache2/modules/mod_perl.so #23 0xb79196ff in modperl_callback_per_dir () from /usr/lib/apache2/modules/mod_perl.so #24 0xb7913f61 in modperl_response_finish () from /usr/lib/apache2/modules/mod_perl.so #25 0xb79141e2 in modperl_response_handler_cgi () from /usr/lib/apache2/modules/mod_perl.so #26 0x08077e48 in ap_run_handler () #27 0x080781cc in ap_invoke_handler () #28 0x08069c7f in ap_process_request () #29 0x08064c52 in _start () XML file used when problem happens: <?xml version="1.0" encoding="UTF-8"?> <lom xmlns="http://www.imsglobal.org/xsd/imsmd_v1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsmd_v1p2p2.xsd"> <general> <title> <langstring lang="nb">Poteten - skadelig eller bra for oss?</langstring> <langstring lang="nn">Er poteten skadeleg eller bra for oss?</langstring> </title> </general> </lom>
From: pajas [...] matfyz.cz
You do not provide any information about what happens with the XML in your application. Try giving a minimal Perl script that reproduces the problem. Otherwise there is no way I can help. Also make sure that no XML::LibXML node leaks from one thread to another. -- Petr On pá 09.lis.2007 07:13:28, http://robin.smidsrod.no/ wrote: Show quoted text
> The problem is also described here:
http://www.perlmonks.org/?node_id=649745 Show quoted text
> > To me it looks like the cleanup at the end of the request does
something Show quoted text
> wrong, but I'm not exactly sure where to look. Is this a libxml bug,
or Show quoted text
> a mod_perl concurrency/thread issue (using prefork mpm in apache2). > > XML-LibXML v1.58 > Perl v5.8.7 built for i486-linux-gnu-thread-multi > Linux gm 2.6.15-29-686 #1 SMP PREEMPT Mon Sep 24 17:24:47 UTC 2007
i686 Show quoted text
> GNU/Linux (Ubuntu 6.06) > Apache 2.0.55-4ubuntu2.2 > mod_perl 2.0.2-2ubuntu1.6.06.1 > > Trace: > > #0 0xb7699e5e in xmlDictOwns () from /usr/lib/libxml2.so.2 > #1 0xb75fe790 in xmlFreeNodeList () from /usr/lib/libxml2.so.2 > #2 0xb75fe734 in xmlFreeNodeList () from /usr/lib/libxml2.so.2 > #3 0xb75fe734 in xmlFreeNodeList () from /usr/lib/libxml2.so.2 > #4 0xb75fe8fa in xmlFreeNode () from /usr/lib/libxml2.so.2 > #5 0xb75b3305 in PmmFreeNode () from > /usr/lib/perl5/auto/XML/LibXML/LibXML.so > #6 0xb75b33fd in PmmREFCNT_dec () from > /usr/lib/perl5/auto/XML/LibXML/LibXML.so > #7 0xb75b33df in PmmREFCNT_dec () from > /usr/lib/perl5/auto/XML/LibXML/LibXML.so > #8 0xb75981aa in XS_XML__LibXML__Node_DESTROY () from > /usr/lib/perl5/auto/XML/LibXML/LibXML.so > #9 0xb786d3b9 in Perl_pp_entersub () from /usr/lib/libperl.so.5.8 > #10 0xb7804f10 in Perl_get_cv () from /usr/lib/libperl.so.5.8 > #11 0xb7808cf1 in Perl_call_sv () from /usr/lib/libperl.so.5.8 > #12 0xb7870079 in Perl_sv_clear () from /usr/lib/libperl.so.5.8 > #13 0xb7870922 in Perl_sv_free () from /usr/lib/libperl.so.5.8 > #14 0xb787039a in Perl_sv_clear () from /usr/lib/libperl.so.5.8 > #15 0xb7870922 in Perl_sv_free () from /usr/lib/libperl.so.5.8 > #16 0xb7895052 in Perl_free_tmps () from /usr/lib/libperl.so.5.8 > #17 0xb7865a1e in Perl_pp_nextstate () from /usr/lib/libperl.so.5.8 > #18 0xb7865917 in Perl_runops_standard ()
from /usr/lib/libperl.so.5.8 Show quoted text
> #19 0xb7804ef0 in Perl_get_cv () from /usr/lib/libperl.so.5.8 > #20 0xb7808cf1 in Perl_call_sv () from /usr/lib/libperl.so.5.8 > #21 0xb7918b7f in modperl_callback () from > /usr/lib/apache2/modules/mod_perl.so > #22 0xb7919451 in modperl_callback_run_handlers () from > /usr/lib/apache2/modules/mod_perl.so > #23 0xb79196ff in modperl_callback_per_dir () from > /usr/lib/apache2/modules/mod_perl.so > #24 0xb7913f61 in modperl_response_finish () from > /usr/lib/apache2/modules/mod_perl.so > #25 0xb79141e2 in modperl_response_handler_cgi () from > /usr/lib/apache2/modules/mod_perl.so > #26 0x08077e48 in ap_run_handler () > #27 0x080781cc in ap_invoke_handler () > #28 0x08069c7f in ap_process_request () > #29 0x08064c52 in _start () > > XML file used when problem happens: > > <?xml version="1.0" encoding="UTF-8"?> > <lom xmlns="http://www.imsglobal.org/xsd/imsmd_v1p2" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.imsglobal.org/xsd/imsmd_v1p2p2.xsd"> > <general> > <title> > <langstring lang="nb">Poteten - skadelig eller bra for
oss?</langstring> Show quoted text
> <langstring lang="nn">Er poteten skadeleg eller bra for
oss?</langstring> Show quoted text
> </title> > </general> > </lom>
Subject: Re: [rt.cpan.org #30610] XML::LibXML::Node::DESTROY causes segfault under mod_perl2
Date: Mon, 12 Nov 2007 09:07:35 +0100
To: bug-XML-LibXML [...] rt.cpan.org
From: Robin Smidsrød <robin [...] smidsrod.no>
Download smime.p7s
application/x-pkcs7-signature 3.2k

Message body not shown because it is not plain text.

Petr Pajas via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=30610 > > > You do not provide any information about what happens with the XML in > your application. Try giving a minimal Perl script that reproduces the > problem. Otherwise there is no way I can help. > >
I think this is the code, but I'm not 100% sure. $param->{'lom'} is the before-mentioned XML data, as a scalar. use Encode (); my $lom_doc=$pf->get_xml_parser()->parse_string( Encode::encode('utf-8', $param->{'lom'} ) ); my $lom_root=$lom_doc->getDocumentElement(); $lom=$lom_root->toString(1); I also have another one similar: my $lom_doc=$self->pf()->get_xml_parser()->parse_string($self->lom_utf8); my $lom_root=$lom_doc->getDocumentElement(); $object->appendChild( $lom_root ); In this case $object was initialized like this: use XML::LibXML (); my $object=XML::LibXML::Element->new( 'object' ); $pf->get_xml_parser() is just a wrapper around XML::LibXML->new(); Show quoted text
> Also make sure that no XML::LibXML node leaks from one thread to > another. > >
How can I check this? I'm just used to programming in Perl. C is not one of my languages. Is there a tool I can use (preferably in the mod_perl2 environment) to figure out this? Pointers/links would be very much appreciated. -- Robin

Message body is not shown because sender requested not to inline it.

From: pajas [...] matfyz.cz
Ok, so I came to the following script that under the scrutiny of valgrind appears to cause some memory-management problem under normal perl. I'll let you know as soon as I find a fix for it and then you can check if it fixes your problem under mod_perl. #!/usr/bin/perl use XML::LibXML (); my $object=XML::LibXML::Element->new( 'object' ); my $xml = <<'EOF'; <?xml version="1.0" encoding="UTF-8"?> <lom/> EOF my $lom_doc=XML::LibXML->new->parse_string($xml); my $lom_root=$lom_doc->getDocumentElement(); $object->appendChild( $lom_root ); __END__ -- Petr
Ok, hopefully this is fixed now. Please fetch the latest XML::LibXML from SVN (svn co svn://axkit.org/XML-LibXML/trunk XML-LibXML), build and install it and try again (I don't know if you have to restart apache or not, I'm totally ignorant about how mod_perl2 works). -- Petr
Subject: Re: [rt.cpan.org #30610] Resolved: XML::LibXML::Node::DESTROY causes segfault under mod_perl2
Date: Mon, 12 Nov 2007 10:28:53 +0100
To: bug-XML-LibXML [...] rt.cpan.org
From: Robin Smidsrød <robin [...] smidsrod.no>
Download smime.p7s
application/x-pkcs7-signature 3.2k

Message body not shown because it is not plain text.

Petr Pajas via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=30610 > > > According to our records, your request has been resolved. If you have any > further questions or concerns, please respond to this message. >
The problem seems to have been fixed! Thank you for a VERY fast fix. Which official version will this fix be in (1.65?), and when is it expected to hit CPAN? -- Robin

Message body is not shown because sender requested not to inline it.

Show quoted text
> Which official version will this fix be in (1.65?),
The fix will go to 1.66 (1.65 is the current release). Show quoted text
> when is it expected to hit CPAN?
In a week or so; I'd like to resolve #29650 first. -- Petr
Show quoted text
> Which official version will this fix be in (1.65?),
The fix will go to 1.66 (1.65 is the current release). Show quoted text
> when is it expected to hit CPAN?
In a week or so (I need to resolve
Show quoted text
> Which official version will this fix be in (1.65?),
The fix will go to 1.66 (1.65 is the current release). Show quoted text
> when is it expected to hit CPAN?
In a week or so (I need to resolve