Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: mathias [...] koerber.org
Cc:
AdminCc:

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



Subject: building on RHEL-5-64 fails : double free
Date: Wed, 06 Mar 2013 12:19:35 +0800
To: bug-XML-LibXML [...] rt.cpan.org
From: Mathias Koerber <mathias [...] koerber.org>
Download (untitled) / with headers
text/plain 15.6k

Message body is not shown because it is too large.

Download (untitled) / with headers
text/plain 420b
Hi Mathias, RHEL’s perl is well-known for being extremely buggy and convulated, and 5.8.8 is a very old version of Perl. Furthermore, there's already RHEL 6 and there will be RHEL 7. In any case, can you check further with your own perl compiled from source on a prefix, and if it works there - blame it on the RHEL perl. See: http://blogs.perl.org/users/anielsen/2010/10/rhel-and-perl.html Regards, -- Shlomi Fish
Download (untitled) / with headers
text/plain 829b
On 2013-03-06 00:14:33, SHLOMIF wrote: Show quoted text
> Hi Mathias, > > RHEL’s perl is well-known for being extremely buggy and convulated, and > 5.8.8 is a very old version of Perl. Furthermore, there's already RHEL 6 > and there will be RHEL 7. In any case, can you check further with your > own perl compiled from source on a prefix, and if it works there - blame > it on the RHEL perl. See: > > http://blogs.perl.org/users/anielsen/2010/10/rhel-and-perl.html >
I doubt it's related to RHEL --- there are other fail reports on Linux with failures in t/40reader_mem_error.t, e.g.: * http://www.cpantesters.org/cpan/report/e7dd2e08-3edc-11e2-a794-8ec2259ac1ba * http://www.cpantesters.org/cpan/report/1e527a52-829d-11e2-9cf9-f42b9106784b * http://www.cpantesters.org/cpan/report/9194af48-3edd-11e2-b54d-31e0259ac1ba Regards, Slaven
From: d.thomas [...] its.uq.edu.au
Download (untitled) / with headers
text/plain 441b
Show quoted text
> >In any case, can you check further with your own perl compiled > > from source on a prefix, and if it works there - blame > > it on the RHEL perl.
I can confirm and provide some detail. I'm building against 5.16.2 installed under /opt/perl: t/40reader_mem_error.t ... glibc detected double free or corruption Which seems to match the 2.0013 entry in Changes. fails for 2.0013 and 2.0014 2.0004, 2.0009, 2.0011, 2.0012 pass all tests.
Subject: 2-0014-test-failure
Download 2-0014-test-failure
application/octet-stream 19.6k

Message body not shown because it is not plain text.

Subject: 2-0013-test-failure
Download 2-0013-test-failure
application/octet-stream 22.7k

Message body not shown because it is not plain text.

From: d.thomas [...] its.uq.edu.au
Download (untitled) / with headers
text/plain 170b
Show quoted text
> fails for 2.0013 and 2.0014 > 2.0004, 2.0009, 2.0011, 2.0012 pass all tests.
I should have mentioned I've had no problems with RHEL6 (which has libxml2 version: 20706)
Download (untitled) / with headers
text/plain 677b
On Sun Mar 10 18:06:28 2013, d.thomas@its.uq.edu.au wrote: Show quoted text
> > fails for 2.0013 and 2.0014 > > 2.0004, 2.0009, 2.0011, 2.0012 pass all tests.
> > I should have mentioned I've had no problems with RHEL6 > (which has libxml2 version: 20706)
I can also confirm this bug on RH5.7 with Perl 5.8 and XML::LibXML 2.0101. Looking at the code there is a real bug with double free but probably in newer versions of glibc it worked without errors. I also discovered a memory leak when using preserveNode. Output of the script "reader_test.pl" that reproduces this problem: Memory usage: 3416365 ... Memory usage: 3607549 ... Memory usage: 3802813 Attached patch to fix these problems.
Subject: 83779.patch
Download 83779.patch
text/x-diff 4.7k
diff -Nura XML-LibXML-2.0101-orig/LibXML.xs XML-LibXML-2.0101/LibXML.xs --- XML-LibXML-2.0101-orig/LibXML.xs 2013-08-15 08:26:18.000000000 +0300 +++ XML-LibXML-2.0101/LibXML.xs 2013-08-17 03:40:42.993527411 +0300 @@ -8790,11 +8790,6 @@ REPORT_ERROR(0); XSRETURN_UNDEF; } - perl_doc = PmmNodeToSv((xmlNodePtr)doc, NULL); - if ( PmmREFCNT(SvPROXYNODE(perl_doc))==1 ) { - /* will be decremented in Reader destructor */ - PmmREFCNT_inc(SvPROXYNODE(perl_doc)); - } if (xmlTextReaderGetParserProp(reader,XML_PARSER_VALIDATE)) PmmInvalidatePSVI(doc); /* the document may have psvi info */ @@ -8873,7 +8868,7 @@ PREINIT: xmlNodePtr node; xmlDocPtr doc; - SV * perl_doc; + ProxyNodePtr proxy; PREINIT_SAVED_ERROR CODE: INIT_ERROR_HANDLER; @@ -8883,16 +8878,16 @@ REPORT_ERROR(0); XSRETURN_UNDEF; } - perl_doc = PmmNodeToSv((xmlNodePtr)doc, NULL); - if ( PmmREFCNT(SvPROXYNODE(perl_doc))==1 ) { - /* will be decremented in Reader destructor */ - PmmREFCNT_inc(SvPROXYNODE(perl_doc)); + proxy = PmmNewNode((xmlNodePtr)doc); + if ( PmmREFCNT(proxy) == 0 ) { + /* new proxy node */ + PmmREFCNT_inc(proxy); } node = xmlTextReaderPreserve(reader); CLEANUP_ERROR_HANDLER; REPORT_ERROR(0); if (node) { - RETVAL = PmmNodeToSv(node, PmmOWNERPO(PmmPROXYNODE(doc))); + RETVAL = PmmNodeToSv(node, proxy); } else { XSRETURN_UNDEF; } @@ -8961,20 +8956,16 @@ xmlTextReaderPtr reader PREINIT: xmlDocPtr doc; - SV * perl_doc; + ProxyNodePtr proxy; /* SV * error_sv = NULL; xmlTextReaderErrorFunc f = NULL; */ CODE: - if (xmlTextReaderReadState(reader) != XML_TEXTREADER_MODE_EOF) { - doc = xmlTextReaderCurrentDoc(reader); - if (doc) { - perl_doc = PmmNodeToSv((xmlNodePtr)doc, NULL); - if ( PmmREFCNT(SvPROXYNODE(perl_doc))>1 ) { - /* was incremented in document() to prevent from PMM destruction */ - PmmREFCNT_dec(SvPROXYNODE(perl_doc)); - } - SvREFCNT_dec(perl_doc); + doc = xmlTextReaderCurrentDoc(reader); + if (doc) { + proxy = PmmNewNode((xmlNodePtr)doc); + if ( PmmREFCNT(proxy) > 0 ) { + PmmREFCNT_dec(proxy); } } if (xmlTextReaderReadState(reader) != XML_TEXTREADER_MODE_CLOSED) { diff -Nura XML-LibXML-2.0101-orig/t/48_RH5_double_free_rt83779.t XML-LibXML-2.0101/t/48_RH5_double_free_rt83779.t --- XML-LibXML-2.0101-orig/t/48_RH5_double_free_rt83779.t 1970-01-01 03:00:00.000000000 +0300 +++ XML-LibXML-2.0101/t/48_RH5_double_free_rt83779.t 2013-08-17 05:03:50.367641211 +0300 @@ -0,0 +1,100 @@ + +use strict; +use warnings; +use Scalar::Util qw(blessed); + +=head1 DESCRIPTION + +Double free on RHEL-5-x86_64. + +See L<https://rt.cpan.org/Ticket/Display.html?id=83779>. + +=cut + +use constant HAS_LEAKTRACE => eval{ require Test::LeakTrace }; +use Test::More HAS_LEAKTRACE ? (tests => 6) : (skip_all => 'Test::LeakTrace is required.'); +use Test::LeakTrace; +use XML::LibXML::Reader; + +my $xml = <<'EOF'; +<html> + <head> + <title>David vs. Goliath - Part I</title> + </head> + <body> + </body> +</html> +EOF + +my $xml_decl = <<'EOF'; +<?xml version="1.0"?> +EOF + +{ + my $r = XML::LibXML::Reader->new(string => $xml); + my @nodes; + while ($r->read) { + push @nodes, $r->name; + } + # TEST + is( + join(',', @nodes), + 'html,#text,head,#text,title,#text,title,#text,head,#text,body,#text,body,#text,html', + 'Check reader' + ); +} + +{ + my $r = XML::LibXML::Reader->new(string => $xml); + while ($r->read) { + $r->preserveNode(); + } + # TEST + is( + $r->document->toString(), + $xml_decl . $xml, + 'Check reader with using preserveNode' + ); +} + +{ + my $r = XML::LibXML::Reader->new(string => $xml); + my $copy; + while ($r->read) { + $copy = $r->copyCurrentNode() if $r->name eq 'body'; + } + # TEST + is( + $copy->toString(), + '<body/>', + 'Check reader with using copyCurrentNode' + ); +} + +# TEST +no_leaks_ok { + my $r = XML::LibXML::Reader->new(string => $xml); + while ($r->read) { + # nothing + } +} 'Check reader, without leaks'; + +# TEST +no_leaks_ok { + my $node; + { + my $r = XML::LibXML::Reader->new(string => $xml); + while ($r->read) { + $node ||= $r->preserveNode(); + } + my $doc = $r->document(); + } +} 'Check reader with using preserveNode, without leaks'; + +# TEST +no_leaks_ok { + my $r = XML::LibXML::Reader->new(string => $xml); + while ($r->read) { + my $copy = $r->copyCurrentNode(); + } +} 'Check reader with using copyCurrentNode, without leaks';
Subject: reader_test.pl
Download reader_test.pl
text/x-perl 343b
#!/usr/bin/perl use strict; use warnings; use Devel::SizeMe qw(perl_size); use XML::LibXML::Reader; for (1..10) { for (1..1000) { my $r = XML::LibXML::Reader->new(string => '<html></html>'); while ($r->read) { $r->preserveNode(); } } print "Memory usage: ", perl_size(), "\n"; sleep 1; }
Hi, this was applied in XML-LibXML-2.0102. However, I sometimes got a test failure in t/40reader_mem_error.t where the reference count went below zero. I cannot always reproduce it, but it seems to have been caused by this patch. Can you investigate? Regards, -- Shlomi Fish On Fri Aug 16 22:44:53 2013, yoreek wrote: Show quoted text
> On Sun Mar 10 18:06:28 2013, d.thomas@its.uq.edu.au wrote:
> > > fails for 2.0013 and 2.0014 > > > 2.0004, 2.0009, 2.0011, 2.0012 pass all tests.
> > > > I should have mentioned I've had no problems with RHEL6 > > (which has libxml2 version: 20706)
> > I can also confirm this bug on RH5.7 with Perl 5.8 and XML::LibXML > 2.0101. > Looking at the code there is a real bug with double free but probably > in newer versions of glibc it worked without errors. > > I also discovered a memory leak when using preserveNode. > Output of the script "reader_test.pl" that reproduces this problem: > Memory usage: 3416365 > ... > Memory usage: 3607549 > ... > Memory usage: 3802813 > > Attached patch to fix these problems.
Download (untitled) / with headers
text/plain 417b
On Mon Aug 19 15:20:28 2013, SHLOMIF wrote: Show quoted text
> Hi, > > this was applied in XML-LibXML-2.0102. However, I sometimes got a test > failure in t/40reader_mem_error.t where the reference count went below > zero. I cannot always reproduce it, but it seems to have been caused > by this patch. Can you investigate? >
Sorry but I can't reproduce it. I tried to run the script more than 1000 times, and no errors -- YOREEK
Download (untitled) / with headers
text/plain 544b
On Mon Aug 19 10:45:06 2013, yoreek wrote: Show quoted text
> On Mon Aug 19 15:20:28 2013, SHLOMIF wrote:
> > Hi, > > > > this was applied in XML-LibXML-2.0102. However, I sometimes got a test > > failure in t/40reader_mem_error.t where the reference count went below > > zero. I cannot always reproduce it, but it seems to have been caused > > by this patch. Can you investigate? > >
> > Sorry but I can't reproduce it. > I tried to run the script more than 1000 times, and no errors
That's OK - I'll try to investigate it myself. Regards, -- Shlomi Fish
From: paul [...] city-fan.org
Download (untitled) / with headers
text/plain 4.6k
On Mon Aug 19 10:51:02 2013, SHLOMIF wrote: Show quoted text
> On Mon Aug 19 10:45:06 2013, yoreek wrote:
> > On Mon Aug 19 15:20:28 2013, SHLOMIF wrote:
> > > Hi, > > > > > > this was applied in XML-LibXML-2.0102. However, I sometimes got a test > > > failure in t/40reader_mem_error.t where the reference count went below > > > zero. I cannot always reproduce it, but it seems to have been caused > > > by this patch. Can you investigate? > > >
> > > > Sorry but I can't reproduce it. > > I tried to run the script more than 1000 times, and no errors
> > That's OK - I'll try to investigate it myself. > > Regards, > > -- Shlomi Fish
I'm also getting lots of errors like this with 2.0102: make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/01basic..............................# # # Compiled against libxml2 version: # 20901# # Running libxml2 version: # 20901# # ok t/02parse..............................ok t/03doc................................ok t/04node...............................ok t/05text...............................ok t/06elements...........................ok t/07dtd................................ok t/08findnodes..........................ok t/09xpath..............................ok t/10ns.................................ok t/11memory.............................skipped all skipped: developers only (set MEMORY_TEST=1 to run these tests) t/12html...............................ok t/13dtd................................ok t/14sax................................ok t/15nodelist...........................ok t/16docnodes...........................ok t/17callbacks..........................ok t/18docfree............................ok t/19die_on_invalid_utf8_rt_58848.......ok t/19encoding...........................ok t/20extras.............................ok t/21catalog............................ok t/23rawfunctions.......................ok t/24c14n...............................ok t/25relaxng............................ok t/26schema.............................ok t/27new_callbacks_simple...............ok t/28new_callbacks_multiple.............ok t/29id.................................ok t/30keep_blanks........................ok t/30xpathcontext.......................ok t/31xpc_functions......................ok t/32xpc_variables......................ok t/35huge_mode..........................ok t/40reader.............................PmmREFCNT_dec: REFCNT decremented below 0 for 8698bc8! at /builddir/build/BUILD/XML-LibXML-2.0102/blib/lib/XML/LibXML.pm line 1549. dubious Test returned status 0 (wstat 139, 0x8b) DIED. FAILED tests 85-100 Failed 16/100 tests, 84.00% okay t/40reader_mem_error...................ok t/41xinclude...........................ok t/42common.............................ok t/43options............................ok t/44extent.............................ok t/45regex..............................ok t/46err_column.........................ok t/47load_xml_callbacks.................ok t/48_memleak_rt_83744..................skipped all skipped: Test::LeakTrace is required for memory leak tests. t/48_removeChild_crashes_rt_80395......ok t/48_replaceNode_DTD_nodes_rT_80521....ok t/48_RH5_double_free_rt83779...........skipped all skipped: Test::LeakTrace is required. t/48_rt55000...........................ok t/48importing_nodes_IDs_rt_69520.......ok t/49_load_html.........................ok t/49callbacks_returning_undef..........ok t/49global_extent......................ok t/50devel..............................ok t/51_parse_html_string_rt87089.........ok t/60error_prev_chain...................ok t/60struct_error.......................ok t/61error..............................ok t/62overload...........................ok t/71overloads..........................ok t/72destruction........................ok t/80registryleak.......................ok t/90threads............................skipped all skipped: optional (set THREAD_TEST=1 to run these tests) t/91unique_key.........................ok t/pod..................................ok t/style-trailing-space.................skipped all skipped: Test::TrailingSpace required for trailing space test. Failed 1/65 test scripts, 98.46% okay. 16/2493 subtests failed, 99.36% okay. Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- t/40reader.t 0 139 100 32 32.00% 85-100 5 tests skipped. make: *** [test_dynamic] Error 255 I getting these with a variety of perls from 5.8.5 to 5.18.1 on both ix86 and x86_64 (all Red Hat / Fedora perls) and probably more than 50% of the time. I think these are all thread-enabled perls, in case that makes any difference.
Download (untitled) / with headers
text/plain 5.7k
On Mon Aug 19 18:21:52 2013, paul@city-fan.org wrote: Show quoted text
> On Mon Aug 19 10:51:02 2013, SHLOMIF wrote:
> > On Mon Aug 19 10:45:06 2013, yoreek wrote:
> > > On Mon Aug 19 15:20:28 2013, SHLOMIF wrote:
> > > > Hi, > > > > > > > > this was applied in XML-LibXML-2.0102. However, I sometimes got a > > > > test > > > > failure in t/40reader_mem_error.t where the reference count went > > > > below > > > > zero. I cannot always reproduce it, but it seems to have been > > > > caused > > > > by this patch. Can you investigate? > > > >
> > > > > > Sorry but I can't reproduce it. > > > I tried to run the script more than 1000 times, and no errors
> > > > That's OK - I'll try to investigate it myself. > > > > Regards, > > > > -- Shlomi Fish
> > I'm also getting lots of errors like this with 2.0102: > > make test > PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" > "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t > t/01basic..............................# > # > # Compiled against libxml2 version: # 20901# > # Running libxml2 version: # 20901# > # > ok > t/02parse..............................ok > t/03doc................................ok > t/04node...............................ok > t/05text...............................ok > t/06elements...........................ok > t/07dtd................................ok > t/08findnodes..........................ok > t/09xpath..............................ok > t/10ns.................................ok > t/11memory.............................skipped > all skipped: developers only (set MEMORY_TEST=1 to run these > tests) > t/12html...............................ok > t/13dtd................................ok > t/14sax................................ok > t/15nodelist...........................ok > t/16docnodes...........................ok > t/17callbacks..........................ok > t/18docfree............................ok > t/19die_on_invalid_utf8_rt_58848.......ok > t/19encoding...........................ok > t/20extras.............................ok > t/21catalog............................ok > t/23rawfunctions.......................ok > t/24c14n...............................ok > t/25relaxng............................ok > t/26schema.............................ok > t/27new_callbacks_simple...............ok > t/28new_callbacks_multiple.............ok > t/29id.................................ok > t/30keep_blanks........................ok > t/30xpathcontext.......................ok > t/31xpc_functions......................ok > t/32xpc_variables......................ok > t/35huge_mode..........................ok > t/40reader.............................PmmREFCNT_dec: REFCNT > decremented below 0 for 8698bc8! at /builddir/build/BUILD/XML-LibXML- > 2.0102/blib/lib/XML/LibXML.pm line 1549. > dubious > Test returned status 0 (wstat 139, 0x8b) > DIED. FAILED tests 85-100 > Failed 16/100 tests, 84.00% okay > t/40reader_mem_error...................ok > t/41xinclude...........................ok > t/42common.............................ok > t/43options............................ok > t/44extent.............................ok > t/45regex..............................ok > t/46err_column.........................ok > t/47load_xml_callbacks.................ok > t/48_memleak_rt_83744..................skipped > all skipped: Test::LeakTrace is required for memory leak tests. > t/48_removeChild_crashes_rt_80395......ok > t/48_replaceNode_DTD_nodes_rT_80521....ok > t/48_RH5_double_free_rt83779...........skipped > all skipped: Test::LeakTrace is required. > t/48_rt55000...........................ok > t/48importing_nodes_IDs_rt_69520.......ok > t/49_load_html.........................ok > t/49callbacks_returning_undef..........ok > t/49global_extent......................ok > t/50devel..............................ok > t/51_parse_html_string_rt87089.........ok > t/60error_prev_chain...................ok > t/60struct_error.......................ok > t/61error..............................ok > t/62overload...........................ok > t/71overloads..........................ok > t/72destruction........................ok > t/80registryleak.......................ok > t/90threads............................skipped > all skipped: optional (set THREAD_TEST=1 to run these tests) > t/91unique_key.........................ok > t/pod..................................ok > t/style-trailing-space.................skipped > all skipped: Test::TrailingSpace required for trailing space > test. > Failed 1/65 test scripts, 98.46% okay. 16/2493 subtests failed, 99.36% > okay. > Failed Test Stat Wstat Total Fail Failed List of Failed > ------------------------------------------------------------------------------- > t/40reader.t 0 139 100 32 32.00% 85-100 > 5 tests skipped. > make: *** [test_dynamic] Error 255 > > I getting these with a variety of perls from 5.8.5 to 5.18.1 on both > ix86 and x86_64 (all Red Hat / Fedora perls) and probably more than > 50% of the time. > > I think these are all thread-enabled perls, in case that makes any > difference.
Hi! I tried to investigate the problem and I think, the main problem in _DESTROY method. When call xmlTextReaderCurrentDoc and did not been called any method such as preserveNode, copyCurrentNode or docuement - there are problems with memory leaks or segfault. Previously used test "if (xmlTextReaderReadState (reader)! = XML_TEXTREADER_MODE_EOF) {" but it is not entirely correct. The libxml2 has an internal flag reader->preserve and it would be more correct to check it before calling xmlTextReaderCurrentDoc, but this flag not available. I would suggest to store this flag in perl hash and then check it before calling xmlTextReaderCurrentDoc. I can offer the following patch, maybe someone will have a better idea. -- YOREEK
Subject: 83779-2.patch
Download 83779-2.patch
text/x-diff 3.1k
diff -Nura XML-LibXML-2.0102-orig/lib/XML/LibXML/Reader.pm XML-LibXML-2.0102/lib/XML/LibXML/Reader.pm --- XML-LibXML-2.0102-orig/lib/XML/LibXML/Reader.pm 2013-08-19 15:14:28.000000000 +0300 +++ XML-LibXML-2.0102/lib/XML/LibXML/Reader.pm 2013-08-20 13:23:30.025052375 +0300 @@ -99,6 +99,8 @@ $EXPORT_TAGS{all}=\@EXPORT_OK; } +our %preserve_flag; + { my %props = ( load_ext_dtd => 1, # load the external subset diff -Nura XML-LibXML-2.0102-orig/LibXML.xs XML-LibXML-2.0102/LibXML.xs --- XML-LibXML-2.0102-orig/LibXML.xs 2013-08-19 15:09:21.000000000 +0300 +++ XML-LibXML-2.0102/LibXML.xs 2013-08-20 14:22:53.064133674 +0300 @@ -1444,6 +1444,39 @@ LibXML_configure_namespaces(ctxt); } +static void +LibXML_set_reader_preserve_flag( xmlTextReaderPtr reader ) { + HV *hash; + char key[32]; + + hash = get_hv("XML::LibXML::Reader::preserve_flag", 0); + if (!hash) { + return; + } + + (void) snprintf(key, sizeof(key), "%p", reader); + (void) hv_store(hash, key, strlen(key), newSV(0), 0); +} + +static int +LibXML_get_reader_preserve_flag( xmlTextReaderPtr reader ) { + HV *hash; + char key[32]; + + hash = get_hv("XML::LibXML::Reader::preserve_flag", 0); + if (!hash) { + return 0; + } + + (void) snprintf(key, sizeof(key), "%p", reader); + if ( hv_exists(hash, key, strlen(key)) ) { + (void) hv_delete(hash, key, strlen(key), G_DISCARD); + return 1; + } + + return 0; +} + extern void boot_XML__LibXML__Devel(pTHX_ CV*); MODULE = XML::LibXML PACKAGE = XML::LibXML @@ -8771,7 +8804,7 @@ xmlNodePtr node = NULL; xmlNodePtr copy; xmlDocPtr doc = NULL; - SV * perl_doc; + ProxyNodePtr proxy; PREINIT: PREINIT_SAVED_ERROR CODE: @@ -8808,6 +8841,12 @@ if ( doc != NULL ) { xmlSetTreeDoc(copy, doc); } + proxy = PmmNewNode((xmlNodePtr)doc); + if (PmmREFCNT(proxy) == 0) { + PmmREFCNT_inc(proxy); + } + LibXML_set_reader_preserve_flag(reader); + docfrag = PmmNewFragment( doc ); xmlAddChild( PmmNODE(docfrag), copy ); RETVAL = PmmNodeToSv(copy, docfrag); @@ -8834,6 +8873,8 @@ if (xmlTextReaderGetParserProp(reader,XML_PARSER_VALIDATE)) PmmInvalidatePSVI(doc); /* the document may have psvi info */ + LibXML_set_reader_preserve_flag(reader); + OUTPUT: RETVAL @@ -8883,6 +8924,8 @@ /* new proxy node */ PmmREFCNT_inc(proxy); } + LibXML_set_reader_preserve_flag(reader); + node = xmlTextReaderPreserve(reader); CLEANUP_ERROR_HANDLER; REPORT_ERROR(0); @@ -8961,10 +9004,13 @@ xmlTextReaderErrorFunc f = NULL; */ CODE: - doc = xmlTextReaderCurrentDoc(reader); - if (doc) { - proxy = PmmNewNode((xmlNodePtr)doc); - if ( PmmREFCNT(proxy) > 0 ) { + if ( LibXML_get_reader_preserve_flag(reader) ) { + doc = xmlTextReaderCurrentDoc(reader); + if (doc) { + proxy = PmmNewNode((xmlNodePtr)doc); + if ( PmmREFCNT(proxy) == 0 ) { + PmmREFCNT_inc(proxy); + } PmmREFCNT_dec(proxy); } }
From: paul [...] city-fan.org
Download (untitled) / with headers
text/plain 441b
On Tue Aug 20 08:01:59 2013, yoreek wrote: Show quoted text
> I can offer the following patch, maybe someone will have a better > idea.
That patch is a big improvement for me. I did 41 different builds and had only one failure, which was a refcount decrementing below 0 during the threads test, and a repeat of that build succeeded. That's about the same frequency of failures, and in the same place that I've been used to seeing before the recent changes.
Download (untitled) / with headers
text/plain 569b
On Tue Aug 20 20:10:18 2013, paul@city-fan.org wrote: Show quoted text
> On Tue Aug 20 08:01:59 2013, yoreek wrote:
> > I can offer the following patch, maybe someone will have a better > > idea.
> > That patch is a big improvement for me. I did 41 different builds and > had only one failure, which was a refcount decrementing below 0 during > the threads test, and a repeat of that build succeeded. That's about > the same frequency of failures, and in the same place that I've been > used to seeing before the recent changes.
This bug is appeared in the t/90threads.t ? -- YOREEK
From: paul [...] city-fan.org
Download (untitled) / with headers
text/plain 921b
On Tue Aug 20 13:56:10 2013, yoreek wrote: Show quoted text
> On Tue Aug 20 20:10:18 2013, paul@city-fan.org wrote:
> > On Tue Aug 20 08:01:59 2013, yoreek wrote:
> > > I can offer the following patch, maybe someone will have a better > > > idea.
> > > > That patch is a big improvement for me. I did 41 different builds and > > had only one failure, which was a refcount decrementing below 0 during > > the threads test, and a repeat of that build succeeded. That's about > > the same frequency of failures, and in the same place that I've been > > used to seeing before the recent changes.
> > This bug is appeared in the t/90threads.t ?
It has the same symptoms but may be a different bug. It occurs much less frequently than 40reader.t was failing in 2.0102 (perhaps 2% of my build attempts, usually on older perls - 5.8.x). The threads test has been failing for me with a similar frequency and in a similar way for a long time.
Download (untitled) / with headers
text/plain 239b
This is probably caused by this bug in libxml2: https://bugzilla.gnome.org/show_bug.cgi?id=447899 Fixed with this commit in libxml2 version 2.7.4: https://git.gnome.org/browse/libxml2/commit/?id=f4653dcd8be8b2b44814b9a3fd358a7bbb87b8c4


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.