Skip Menu |

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 7274
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: kulikku [...] yahoo.com
Cc:
AdminCc:

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



Subject: SegFault with Perl thread + HTTP::Request on SMP(Linux kernal 2.4.21).)
The following code will result in segmentation fault occasionally, Show quoted text
------- code start -------- use strict; use threads; use HTTP::Request; our $thread_num = 5; our $msg_per_thread = 100; our $thr_handler = sub{ my $thr_id = shift; foreach my $id (1..$msg_per_thread){ my $req = HTTP::Request->new('GET', 'http://localhost.com'); $req->header( 'field1' => 'value1', 'field2' => 'value2', ); print "$id. " . $req->as_string; } }; my @threads; for(my $i=0; $i < $thread_num; $i++){ push @threads, threads->new($thr_handler, $i); } foreach my $thread (@threads){ $thread->join; }
------- code end -------- But, the code will work fine without SMP on linux (Perl 5.8.5). Any idea or solution? Please help. Thanks! Regards, KulikKu
[guest - Fri Aug 6 07:33:22 2004]: Show quoted text
> The following code will result in segmentation fault occasionally, > > ------- code start -------- > use strict; > use threads; > > use HTTP::Request; > > our $thread_num = 5; > our $msg_per_thread = 100; > > our $thr_handler = sub{ > my $thr_id = shift; > > foreach my $id (1..$msg_per_thread){ > my $req = HTTP::Request->new
('GET', 'http://localhost.com'); Show quoted text
> $req->header( > 'field1' => 'value1', > 'field2' => 'value2', > ); > > print "$id. " . $req->as_string; > } > }; > > my @threads; > for(my $i=0; $i < $thread_num; $i++){ > push @threads, threads->new($thr_handler, $i); > } > > foreach my $thread (@threads){ > $thread->join; > } > > ------- code end -------- > > But, the code will work fine without SMP on linux (Perl 5.8.5). Any > idea or solution? Please help. > > Thanks! > > > Regards, > KulikKu
Try updating to libwww 5.801. That fixes libwww bug #6781 (which is a work-around for Perl sort bug #30333). If that doesn't work, you may need to patch your perl because of perl core bug #31851 ("Threading crash with closures"). Note that bug #31851 affects multi-cpu machines only. This closure bug is discussed here: <http://www.perlmonks.org/?node_id=409473>. HTH. /-\