Skip Menu |

This queue is for tickets about the HTTP-Lite CPAN distribution.

Report information
The Basics
Id: 15626
Status: resolved
Priority: 0/
Queue: HTTP-Lite

People
Owner: Nobody in particular
Requestors: florian.kirchmeir [...] web.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.4
Fixed in: (no value)



Subject: infinite loop in http_write
Hi all! Here is a probleme I ran into recently, along with a patch that should fix it. I had an application using HTTP::Lite v2.1.6 suddenly lock up and use 100% CPU (running on RedHat FC1, perl 5.8.3). Checking the process with strace yields the following (see below). Line 622 is in the while-loop at the end of the http_write method. Obviously, errors in the syswrite call are not beeing checked, causing an infinite loop here. I've added a patch below that should fix the problem. Best regards, Florian Kirchmeir strace output: --- SIGPIPE (Broken pipe) @ 0 (0) --- write(2, "Use of uninitialized value in addition (+) at /home/sam/sam/lib/HTTP/Lite.pm line 622.\n", 87) = 87 write(4, "User-Agent: HTTP::Lite/2.1.6\r\n", 30) = -1 EPIPE (Broken pipe) --- SIGPIPE (Broken pipe) @ 0 (0) --- write(2, "Use of uninitialized value in addition (+) at /home/sam/sam/lib/HTTP/Lite.pm line 622.\n", 87) = 87 write(4, "User-Agent: HTTP::Lite/2.1.6\r\n", 30) = -1 EPIPE (Broken pipe) --- SIGPIPE (Broken pipe) @ 0 (0) --- write(2, "Use of uninitialized value in addition (+) at /home/sam/sam/lib/HTTP/Lite.pm line 622.\n", 87) = 87 write(4, "User-Agent: HTTP::Lite/2.1.6\r\n", 30) = -1 EPIPE (Broken pipe) --- SIGPIPE (Broken pipe) @ 0 (0) --- write(2, "Use of uninitialized value in addition (+) at /home/sam/sam/lib/HTTP/Lite.pm line 622.\n", 87) = 87 write(4, "User-Agent: HTTP::Lite/2.1.6\r\n", 30) = -1 EPIPE (Broken pipe) ... Patch: Index: lib/HTTP/Lite.pm =================================================================== RCS file: /home/sam/cvs/sam/lib/HTTP/Lite.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -r1.1 -r1.2 620a621 Show quoted text
> die $! unless(defined $bytes || $!{EAGAIN}); # non-recoverable error occured!
622c623,625 < $bytes += syswrite($fh, $line, length($line)-$bytes, $bytes ); # also here --- Show quoted text
> my $moreBytes = syswrite($fh, $line, length($line)-$bytes, $bytes ); # also here > die $! unless(defined $moreBytes || $!{EAGAIN}); # non-recoverable error occured! > $bytes += $moreBytes;