Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
2k stars 559 forks source link

Perl Segmentation Fault on RedHat 6.2 #2346

Closed p5pRT closed 21 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#3671 (status was 'resolved')

Searchable as RT3671$

p5pRT commented 24 years ago

From jens@fiend.cis.com

Created by jens@misfit.cis.com

I am using LWP​::UserAgent and CGI in a simple script and perl intermitantly seg faults\, and cores out. I have no more info than that.

Here is the script​:

#!/usr/local/bin/perl -d​:DProf

use CGI;

use LWP​::UserAgent; $ua = new LWP​::UserAgent; $ua->agent("Bob/0.1 " . $ua->agent);

my @​days = qw(Sun Mon Tue Wed Thu Fri Sat); my @​months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); my $dt;

$cgi = new CGI; my $url = $cgi->param('url');

($domain = $url) =~ s/.*?\.(.+)\..{2\,}$/$1/; my $path = $cgi->param('path');

if(-e "/cache/$domain/$path") {   my @​dt = localtime((stat("/cache/$domain/$path"))[9]);   my $hr = $dt[2] - 7;   $dt[1] =~ s/^(\d)$/0$1/;   $dt[0] =~ s/^(\d)$/0$1/;   $hr =~ s/^(\d)$/0$1/;   $dt = $days[$dt[6]]."\, ".$dt[3]." ".$months[$dt[4]]." ". ($dt[5] + 1900) ." ". $hr ."​:".$dt[1]."​:".$dt[0]." GMT"; }

my $method = $cgi->request_method() || 'GET';

my $req = new HTTP​::Request $method => "http​://$url/$path";

#$req->header('If-Modified-Since' => 'Wed\, 26 May 1999 17​:24​:00 GMT'); print "$dt\n"; $req->header('If-Modified-Since' => $dt);

my $res = $ua->request($req);

foreach(keys(%{$res->headers})) {   print "$_ => ".$res->headers->{$_}."\n"; } print $res->content;

Perl Info ``` Flags: category=core severity=high Site configuration information for perl v5.6.0: Configured by jens at Mon Jul 17 10:55:07 MDT 2000. Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration: Platform: osname=linux, osvers=2.2.14-5.0, archname=i686-linux-thread uname='linux misfit 2.2.14-5.0 #1 tue mar 7 21:07:39 est 2000 i686 unknown ' config_args='-Duseshrplib -Doptimize=-g -Uusemymalloc -D cc=gcc -Dusethreads -Duse5005threads -d' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=define useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef Compiler: cc='gcc', optimize='-g', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) cppflags='-D_REENTRANT -DDEBUGGING -fno-strict-aliasing -I/usr/local/include' ccflags ='-D_REENTRANT -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lpthread -lc -lposix -lcrypt libc=/lib/libc-2.1.3.so, so=so, useshrplib=true, libperl=libperl.so Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/local/lib/perl5/5.6.0/i686-linux-thread/CORE' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Locally applied patches: @INC for perl v5.6.0: /usr/local/lib/perl5/5.6.0/i686-linux-thread /usr/local/lib/perl5/5.6.0 /usr/local/lib/perl5/site_perl/5.6.0/i686-linux-thread /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl . Environment for perl v5.6.0: HOME=/home/jens LANG=en_US LANGUAGE (unset) LD_LIBRARY_PATH=:/usr/local/jdk1.3/lib:/usr/local/lib:/usr/local/jdk1.3/lib:/usr/local/lib:/usr/local/jdk1.3/lib:/usr/local/lib LOGDIR (unset) PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/jdk1.3/bin:/home/jens/bin:/usr/local/jdk1.3/bin:/usr/X11R6/bin:/usr/local/jdk1.3/bin:/home/jens/bin PERL_BADLANG (unset) SHELL=/bin/bash ```
p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

I think the problem is in DProf but I haven't had time to investigate any further.

p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

Can anyone duplicate this error? It happens once every 10 runs.

Here is the script​:

#!/usr/local/bin/perl -d​:DProf

use CGI;

use LWP​::UserAgent; $ua = new LWP​::UserAgent; $ua->agent("Bob/0.1 " . $ua->agent);

my @​days = qw(Sun Mon Tue Wed Thu Fri Sat); my @​months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); my $dt;

$cgi = new CGI; my $url = $cgi->param('url');

($domain = $url) =~ s/.*?\.(.+)\..{2\,}$/$1/; my $path = $cgi->param('path');

if(-e "/cache/$domain/$path") { my @​dt = localtime((stat("/cache/$domain/$path"))[9]); my $hr = $dt[2] - 7; $dt[1] =~ s/^(\d)$/0$1/; $dt[0] =~ s/^(\d)$/0$1/; $hr =~ s/^(\d)$/0$1/; $dt = $days[$dt[6]]."\, ".$dt[3]." ".$months[$dt[4]]." ". ($dt[5] + 1900) ." ". $hr ."​:".$dt[1]."​:".$dt[0]." GMT"; }

my $method = $cgi->request_method() || 'GET';

my $req = new HTTP​::Request $method => "http​://$url/$path";

#$req->header('If-Modified-Since' => 'Wed\, 26 May 1999 17​:24​:00 GMT'); print "$dt\n"; $req->header('If-Modified-Since' => $dt);

my $res = $ua->request($req);

foreach(keys(%{$res->headers})) { print "$_ => ".$res->headers->{$_}."\n"; } print $res->content;