Skip Menu |

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

Report information
The Basics
Id: 98569
Status: open
Priority: 0/
Queue: XML-Twig

People
Owner: Nobody in particular
Requestors: wheiss [...] office-vienna.at
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 3.39
  • 3.40
  • 3.41
  • 3.42
  • 3.44
  • 3.45
  • 3.46
  • 3.47
  • 3.48
Fixed in: (no value)



Subject: CORE::exit trashes file handles
Twig on Linux drops open filehandles via calling END, affecting e.g. DBI Tested on Linux Sample program: use LockFile::Simple; use XML::Twig; my $dbh = DBI->connect('....); my $lockmgr = LockFile::Simple->make(-autoclean=>1, -stale=>1, -hold=>0); $lockmgr->trylock("/tmp/.".DST) || die "can't lock /tmp/.".DST."\n"; my $t = XML::Twig->new( twig_handlers => { 'mapping' => \&mapme, } ); $t->parseurl(URL); # HERE parseurl calls CORE::exit # this triggers a lockfile release. # it also causes e.g. DBI to drop the connection, invalidating prepared statements from IRC: "possibly XML::Twig should be using POSIX::_exit instead, although that won't work on win32" Parseurl is therefore unusable when using any filelocks that act on END, as the child forked by XML::Twig seems to call the END handlers of all open handlers. Backtrace: WARNING: releasing 1 pending lock... at /usr/share/perl5/Log/Agent/Driver/Default.pm line 140 Log::Agent::Driver::Default::logwarn('Log::Agent::Driver::Default=HASH(0x22649b8)', 'Log::Agent::Message=ARRAY(0x1a19d90)') called at blib/lib/Log/Agent.pm (autosplit into blib/lib/auto/Log/Agent/logwarn.al) line 326 Log::Agent::logwarn(undef) called at /usr/share/perl5/LockFile/Manager.pm line 103 LockFile::Manager::release_all('LockFile::Manager=HASH(0x1a1a0d8)') called at /usr/share/perl5/LockFile/Manager.pm line 110 LockFile::Manager::END() called at /usr/share/perl5/XML/Twig.pm line 1203 eval {...} called at /usr/share/perl5/XML/Twig.pm line 1203
Subject: Re: [rt.cpan.org #98569] CORE::exit trashes file handles
Date: Thu, 04 Sep 2014 18:04:05 +0200
To: bug-XML-Twig [...] rt.cpan.org
From: mirod <xmltwig [...] gmail.com>
Thanks, I'll look at it this weekend. -- mirod On 09/03/2014 12:50 AM, wheiss@office-vienna.at via RT wrote: Show quoted text
> Tue Sep 02 18:50:20 2014: Request 98569 was acted upon. > Transaction: Ticket created by wheiss@office-vienna.at > Queue: XML-Twig > Subject: CORE::exit trashes file handles > Broken in: 3.39, 3.40, 3.41, 3.42, 3.44, 3.45, 3.46, 3.47, 3.48 > Severity: (no value) > Owner: Nobody > Requestors: wheiss@office-vienna.at > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=98569 > > > > Twig on Linux drops open filehandles via calling END, affecting e.g. DBI > Tested on Linux > > Sample program: > use LockFile::Simple; > use XML::Twig; > my $dbh = DBI->connect('....); > my $lockmgr = LockFile::Simple->make(-autoclean=>1, -stale=>1, -hold=>0); > $lockmgr->trylock("/tmp/.".DST) || die "can't lock /tmp/.".DST."\n"; > my $t = XML::Twig->new( twig_handlers => { 'mapping' => \&mapme, } ); > $t->parseurl(URL); > # HERE parseurl calls CORE::exit > # this triggers a lockfile release. > # it also causes e.g. DBI to drop the connection, invalidating prepared statements > > from IRC: > "possibly XML::Twig should be using POSIX::_exit instead, although that won't work on win32" > > Parseurl is therefore unusable when using any filelocks that act on END, as the child forked by XML::Twig seems to call the END handlers of all open handlers. > > Backtrace: > WARNING: releasing 1 pending lock... > at /usr/share/perl5/Log/Agent/Driver/Default.pm line 140 > Log::Agent::Driver::Default::logwarn('Log::Agent::Driver::Default=HASH(0x22649b8)', 'Log::Agent::Message=ARRAY(0x1a19d90)') called at blib/lib/Log/Agent.pm (autosplit into blib/lib/auto/Log/Agent/logwarn.al) line 326 > Log::Agent::logwarn(undef) called at /usr/share/perl5/LockFile/Manager.pm line 103 > LockFile::Manager::release_all('LockFile::Manager=HASH(0x1a1a0d8)') called at /usr/share/perl5/LockFile/Manager.pm line 110 > LockFile::Manager::END() called at /usr/share/perl5/XML/Twig.pm line 1203 > eval {...} called at /usr/share/perl5/XML/Twig.pm line 1203 > >