Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Script using Tk and LibXML crashing

by misczol (Initiate)
on Aug 05, 2019 at 16:37 UTC ( #11103967=perlquestion: print w/replies, xml ) Need Help??

misczol has asked for the wisdom of the Perl Monks concerning the following question:

Hello Perl Monks, I'm trying to load a 290MB XML file using Tk and LibXML. I'm on Windows 7 64bit with 8GB of RAM using strawberry 'perl 5, version 30, subversion 0 (v5.30.0) built for MSWin32-x64-multi-thread'

This is the stripped down version of the script that's been crashing:

use strict; use XML::LibXML; use Tk; my $filename; my $xpc; my $mw = MainWindow->new( -title => 'GUI' ); $mw->Button( -text => 'Load XML', -command => \&tk_Load_Export )->grid +(-column => '0', -row => '0', -sticky => 'e'); MainLoop; sub tk_Load_Export { $filename = $mw->getOpenFile( -title => 'Load XML', -defaultextensio +n => '.xml', -initialdir => '.' ) or return; import_XML($filename); } sub import_XML { print "Reading the XML file $filename\n\n"; my $dom = XML::LibXML->load_xml(location => $filename, huge => 1); $xpc = XML::LibXML::XPathContext->new($dom); print "XML imported\n"; }

After I get 'XML imported' output the script crashes with these 'Perl interpreter stopped working' Windows messages

Problem signature: Problem Event Name: APPCRASH Application Name: perl.exe Application Version: 5.30.0.1 Application Timestamp: 5ce675b5 Fault Module Name: Tk.xs.dll Fault Module Version: 8.4.2.5 Fault Module Timestamp: 5d48325f Exception Code: c0000005 Exception Offset: 000000000006b197 OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1033 Additional Information 1: 0922 Additional Information 2: 09222532a50de2713b0e459db9ce5206 Additional Information 3: 1a6d Additional Information 4: 1a6d675851be0305a03f72c1d1fc7bfd -- Problem signature: Problem Event Name: APPCRASH Application Name: perl.exe Application Version: 5.30.0.1 Application Timestamp: 5ce675b5 Fault Module Name: Tk.xs.dll Fault Module Version: 8.4.2.5 Fault Module Timestamp: 5d48325f Exception Code: c000041d Exception Offset: 000000000006b197 OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1033 Additional Information 1: 0561 Additional Information 2: 056116c4c04c02ca22cbeb428d55467a Additional Information 3: dab2 Additional Information 4: dab22cdd161f9720b851e7ce36d909c8

Sometimes but not always I also get this message after 'XML imported' output:

Free to wrong pool 46af30 not 645b4f4a at C:/Strawberry/perl/site/lib/ +Tk.pm line 424.

Is this because of the file size? The script doesn't crash on smaller XML files (~200MB).

Can someone help me understand why this is happening and how do I mitigate this?

Replies are listed 'Best First'.
Re: Script using Tk and LibXML crashing (Devel::Trace)
by Anonymous Monk on Aug 06, 2019 at 00:56 UTC
      Thank you for your answer. Here's what I got, but I don't really know what to make of this. Tk library seems to be the problem, and my google searches indicate that this has something to do with threads it's using, but I'm still lost
      >> C:/Strawberry/perl/site/lib/Tk/Button.pm:86: my $w = shift; >> C:/Strawberry/perl/site/lib/Tk/Button.pm:87: $w->configure('-state +'=>'normal') if ($w->cget('-state') ne 'disabled'); >> C:/Strawberry/perl/site/lib/Tk/Button.pm:90: if (exists $w->{__rel +ief__}) >> C:/Strawberry/perl/site/lib/Tk/Button.pm:92: if (exists $w->{__p +relief__} && >> C:/Strawberry/perl/site/lib/Tk/Button.pm:97: delete $w->{__relie +f__}; >> C:/Strawberry/perl/site/lib/Tk/Button.pm:98: delete $w->{__preli +ef__}; >> C:/Strawberry/perl/site/lib/Tk/Button.pm:100: undef $Tk::window; >> C:/Strawberry/perl/site/lib/Tk.pm:424: DoOneEvent(0); >> C:/Strawberry/perl/site/lib/Tk.pm:424: DoOneEvent(0); Free to wrong pool 369f80 not 29dd8a50 at C:/Strawberry/perl/site/lib/ +Tk.pm line 424.

        hmm,

        I'd say kick that up to rt://Tk

        Does it happen if you avoid getOpenFile? Like so

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11103967]
Approved by Corion
Front-paged by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2019-12-08 15:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?