Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[mp2] Problem reading from sockets under high volume.: msg#00202

apache.mod-perl.devel

Subject: [mp2] Problem reading from sockets under high volume.

-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:

To generate a page I am doing a very simple http get to a remote server
for some XML data that I later process. I have written a module to do
this that contains the subroutine I cobbled together to do this. The
module works correctly but under heavy load I get hundreds of:

ERROR Interrupted system call

This does not occur during with few clients, nor when I make it into a
small program and run it from the command line. From the man page of
select() EINTR is supposed to be caused by an uncaught signal. How can
I tell what it is? There are no signals that I know of being generated,
nor any reason for them. I think this is a bug in either mod_perl,
perl, or Apache but I haven't a cloo as to what to do to narrow it down.

Thanks for your kind attention.

Richard

##########
use strict;
use Symbol;
use Fcntl qw(:DEFAULT);
use Socket;

use Time::HiRes;

sub simple {
my $host = shift || return undef;
my $port = shift || return undef;
my $mesg = shift || return undef;
my $timeout = shift || 60;
my $t0 = Time::HiRes::time(); my $ti;
my $proto = getprotobyname('tcp');
my $iaddr = inet_aton($host) || return undef;
my $paddr = sockaddr_in($port, $iaddr);
my $s = Symbol::gensym;
socket($s, PF_INET, SOCK_STREAM, $proto) || return undef;
connect($s, $paddr) || return undef;
my $fd = fileno($s);
my $t; my $b; my $res; my $nf; my $tl;
my $buf = "\000" x 8120; ## BUFSIZ
my $l = length($mesg);
my $rin = 0 ; my $win = 0 , my $ein = 0; my $rout = 0; my $wout = 0; my
$eout = 0;
vec($rin, $fd, 1) = 1;
vec($win, $fd, 1) = 1;
$ein = $rin | $win;
my $i;
$t = 0; $b = 0;
while (($nf, $tl) = select(undef, $wout=$win, $eout=$ein, 2)) {
$i++;
$ti = Time::HiRes::time() - $t0;
if ($ti > $timeout) {
print STDERR "Timed out writing ($ti) $!\n";
shutdown($s, 2);
return undef;
}
if (vec($wout, $fd, 1) == 1) {
$b = syswrite($s, $mesg, $l - $b, $b);
$t = $t + $b;
last if $t = $l;
}
if (vec($eout, $fd, 1) == 1) {
print STDERR "Got an error while writing: $!\n";
shutdown($s, 2);
return undef;
}
}
$t = 0; $l = 0; $b = 0;
while (($nf, $tl) = select($rout=$rin, undef, $eout=$ein, 2)) {
$i++;
$ti = Time::HiRes::time() - $t0;
if ($!) {
print STDERR "ERROR $!\n";
}
if ($ti > $timeout) {
print STDERR "Timed out reading ($ti) $!\n";
shutdown($s, 2);
return undef;
}
if (vec($rout, $fd, 1) == 1) {
$b = sysread($s, $buf, 8192);
$t = $t + $b;
last if $b == 0;
$res .= $buf;
}
if (vec($eout, $fd, 1) == 1) {
print STDERR "Got an error while reading: $!\n";
shutdown($s, 2);
return undef;
}
}
shutdown($s, 2);
return $res;
}


2. Used Components and their Configuration:

*** using
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Apache2/Apache/BuildConfig.pm
*** Makefile.PL options:
MP_APXS => /usr/sbin/apxs2
MP_AP_PREFIX => /usr
MP_DEBUG => 1
MP_GENERATE_XS => 1
MP_INST_APACHE2 => 1
MP_LIBNAME => mod_perl
MP_TRACE => 1
MP_USE_DSO => 1


*** /usr/sbin/httpd -V
Server version: Apache-AdvancedExtranetServer/2.0.45
Server built: Jun 26 2003 10:49:49
Server's Module Magic Number: 20020903:0
Architecture: 32-bit
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/worker"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D HTTPD_ROOT="/etc/httpd/2.0"
-D SUEXEC_BIN="/usr/sbin/apache2-suexec"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd2.conf"


*** /usr/bin/perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.20-2mdkenterprise,
archname=i386-linux-thread-multi
uname='linux no.mandrakesoft.com 2.4.20-2mdkenterprise #1 smp mon
dec 9 14:28:32 cet 2002 i686 unknown unknown gnulinux '
config_args='-des -Darchname=i386-linux -Dcc=gcc -Doptimize=-O2
-fomit-frame-pointer -pipe -march=i586 -mcpu=pentiumpro -Dprefix=/usr
-Dvendorprefix=/usr -Dsiteprefix=/usr -Dman3ext=3pm -Dcf_by=MandrakeSoft
-Dmyhostname=localhost -Dperladmin=root@localhost -Dd_dosuid -Ud_csh
-Duseshrplib -Dusethreads'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2 -fomit-frame-pointer -pipe -march=i586
-mcpu=pentiumpro',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-I/usr/include/gdbm'
ccversion='', gccversion='3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
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, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lndbm -lgdbm -ldl -lm -lpthread -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
libc=/lib/libc-2.3.1.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.3.1'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic
-Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
Built under linux
Compiled at Mar 6 2003 22:13:55
%ENV:
PERL_LWP_USE_HTTP_10="1"
@INC:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
.


3. This is the core dump trace: (if you get a core dump):

[CORE TRACE COMES HERE]

This report was generated by -e on Thu Jun 26 18:41:08 2003 GMT.

-------------8<---------- End Bug Report --------------8<----------

Note: Complete the rest of the details and post this bug report to
dev <at> perl.apache.org. To subscribe to the list send an empty
email to dev-subscribe@xxxxxxxxxxxxxxxx

--
Richard F. Rebel
rrebel@xxxxxxxxx
t. 212.239.0000


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
hardware.arm.at...    cms.citadel.dev...    video.gstreamer...    java.facelets.u...    misc.basics.qna...    web.wiki.instik...    network.uip.use...    xdg.devel/2003-...    tex.bibtex.bibd...    finance.quotesp...    ietf.zeroconf/2...    redhat.blinux.g...    suse.db2/2003-0...    php.phpesp/2004...    uml.devel/2003-...    gnome.labyrinth...    qnx.openqnx.dev...    boot-loaders.gr...    db.dataperfect....    audio.audacity....    linux.uclinux.m...    editors.j.devel...    os.openbsd.tech...    kde.users.multi...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation