Subject: | Having seg fault with script on multi thread perl systems |
Hello,
when I use XML-Twig-3.38 in the stripped down script to extract some
information from the XML File, I get a segmentation fault with the
return statement.
I get the seg fault on the following systems:
/usr/bin/perl -v
This is perl, v5.8.8 built for i586-linux-thread-multi
uname -a
Linux sl90113 2.6.16.60-0.58.1-xenpae #1 SMP Wed Dec 2 12:27:56 UTC 2009
i686 i686 i386 GNU/Linux
====
perl -v
This is perl, v5.10.0 built for x86_64-linux-thread-multi
uname -a
Linux sl01166 2.6.27.39-0.2-xen #1 SMP 2009-11-23 12:57:38 +0100 x86_64
x86_64 x86_64 GNU/Linux
=====
Then I recompiled a new perl on system sl90113 without the following
options:
If this doesn't make any sense to you, just accept the default 'n'.
Build a threading Perl? [n]
If this doesn't make any sense to you, just accept the default 'n'.
Build Perl for multiplicity? [n]
I now have:
/usr/local/bin/perl -v
This is perl, v5.10.0 built for i686-linux-64int
Now the programm works fine. The problem for reproducing the bug is,
that the xml file need a size bigger than 25 MB. I can offer such kind
of file but not for public availability. I have a smaller one added with
dummy data for seeing the xml structure.
Regards,
Thorsten
Subject: | ex_seg_fault.pl |
#!/usr/local/bin/perl
use Data::Dumper;
use XML::Twig;
# define the functions
sub f_create_twig {
# create the twig of group and group members
my $group = $_[0];
my $cma = $_[1];
my $conf = ${$_[2]};
my $DEBUG = $_[3];
my %all_mem_twig;
my $group_found = 0;
my $twig = XML::Twig->new(pretty_print => 'indented');
$twig->parsefile("./eg_seg_fault.xml");
my $root = $twig->root;
# first find the searched group and all it's members
foreach my $no ($root->children('network_object')){
if (($no->first_child_text('type') eq "group") and ($no->first_child_text('Name') eq $group)) {
print "group: " . $no->first_child_text('Name') . "\n" if $DEBUG;
$group_twig = $no->sprint(0);
foreach $mem ($no->first_child('members')->children('reference')) {
print "mem: " . $mem->first_child_text('Name') . "\n" if $DEBUG;
push(@all_members,$mem->first_child_text('Name'));
$group_found = 1;
} # end foreach
} # end if
last if $group_found;
} # end foreach
if (!$group_found) {
# group was not found on this cma
print "The group $group was not found on CMA $cma\n";
return 0;
}
print "all mem: @all_members\n" if $DEBUG;
foreach my $no ($root->children('network_object')) {
foreach my $mem_name (@all_members) {
if ($no->first_child_text('Name') eq $mem_name) {
$all_mem_twig{$mem_name} = $no->sprint(0);
} # end if
} # end foreach
} # enf foreach
return $group_twig, %all_mem_twig;
} # end sub f_create_twig
$DEBUG = 1;
my @cmas;
@cmas =("site", "third_customer");
# normally is here the config parameters from config file
$conf = "config";
# get master xml
my ($master_group_twig,%master_mem_twig) = &f_create_twig("g_xTD-test-lok","application",\$conf,$DEBUG);
# create cma xmls
# print "before cma loop: @cmas\n";
# foreach my $cma (@cmas) {
# print "cma-loop:$groupname - cma: $cma\n" if $DEBUG;
# # create from every cma one twig of the group and an array of twigs for all members of the group
# my ($cma_group_twig,%cma_mem_twig) = &f_create_twig($groupname,$cma,\$conf,$DEBUG);
#print "after return of f_create_twig\n";
# # group is not found in this cma
# next if (!$cma_group_twig);
# # compare the member names of the groups
# # this print out when something is different in the amount or names of the members between master
# &f_cmp_mem(\%master_mem_twig,\%cma_mem_twig,$cma,$groupname,$config{groups}->{$groupname}->{master},$DEBUG);
# # now compare each member of the cma to the member of the master
# #print "cmp_xml: $master_xml-$tmp_xml-$cma-$group-$DEBUG\n" if $DEBUG;
# #&f_cmp_xml($master_group_twig,$cma_group_twig,$cma,$groupname,$DEBUG);
# }
print "\nEND\n" if $DEBUG;
exit 0;
Subject: | dev_network_objects.xml |
Message body is not shown because it is too large.