Re: Apache Error of $r-read failed to read

2003-06-12 Thread Chris Faust
I FOUND IT!!

Like you said, it was in CGI.pm. It happens when doing a file upload

##
while ($bytesread=read($image_filename_one,$buffer,1024)) {
print OUTFILE $buffer;
  }
##

If during the upload the user stops, drops or dies then the errors come
through which makes me think now that its not as serious of a error as I
thought (meaning any ill effects I may have thought was a result of that
error message, really isn't).

At very least at least I know what causes it.

Thanks
-Chris



- Original Message - 
From: Stas Bekman [EMAIL PROTECTED]



 You probably use CGI.pm or something else that calls $r-read(). This
happends
 in xs/Apache/RequestIO/Apache__RequestIO.h (hint grep the mod_perl source
code):

  /*
   * XXX: as stated in ap_get_client_block, the real
   * error gets lots, so we only know that there was one
   */
  ap_log_error(APLOG_MARK, APLOG_ERR, 0, r-server,
   mod_perl: $r-read failed to read);
  break;

 As you can see from the comment due to a bad implementation of
 ap_get_client_block in Apache, the error is not available. I'm planning to
 rewrite all these functions to get rid of ap_get_client_block, and work
with
 bucket brigades instead.

 In any case that won't solve the problem that you are seeing, I'd dig in
 Apache. e.g. trying to use mod_cgi (which doesn't use ap_get_client_block)
to
 reproduce the problem and ask at the httpd list.

 __
 Stas BekmanJAm_pH -- Just Another mod_perl Hacker
 http://stason.org/ mod_perl Guide --- http://perl.apache.org
 mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
 http://modperlbook.org http://apache.org   http://ticketmaster.com



  We have been having some problems where all of a sudden apache will
  start logging the error of:
 
  [error] mod_perl: $r-read failed to read
 




Re: Apache Error of $r-read failed to read

2003-05-30 Thread Stas Bekman
[bouncing back to the list with additional info]

Chris Faust wrote:
Ouch, in other words its going to be a tough on to track down :)..

Thanks Stas, I at least have some direction now.
what you could do is to go to the httpd source and change it to log the error. 
Look in modules/http/http_protocol.c:1884

/* We lose the failure code here.  This is why ap_get_client_block should
 * not be used.
 */
if (rv != APR_SUCCESS) {
/* if we actually fail here, we want to just return and
 * stop trying to read data from the client.
 */
r-connection-keepalive = AP_CONN_CLOSE;
apr_brigade_destroy(bb);
return -1;
}
So log it there:

if (rv != APR_SUCCESS) {
  ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, read failed);
/* if we actually fail here, we want to just return and
 * stop trying to read data from the client.
 */
r-connection-keepalive = AP_CONN_CLOSE;
apr_brigade_destroy(bb);
return -1;
}


-Chris

- Original Message - 
From: Stas Bekman [EMAIL PROTECTED]
To: Chris Faust [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, May 28, 2003 8:15 PM
Subject: Re: Apache Error of $r-read failed to read



Chris Faust wrote:

Hi,

We have been having some problems where all of a sudden apache will
start logging the error of:
[error] mod_perl: $r-read failed to read

Multiple times (100s in less then 10th of a sec), often it will get to
the point where load on the machine goes through the roof and apache has
problems responding and it appears to be the number of requests that are
happening as limits that shouldn't be reached like DB connections and
apache processes are maxing out during non-peak hours.
From what we could see it looked like someone outside was sending all
kind of linefeeds and whatnot within the URL which was documented in the
Apache 45 release which we did update - now we are down to getting the
above mod_perl error and shortly after that starts all hell breaks

loose.

Nowhere in our code do we directly call the read method nor can I find
anything relating to the error so I'm a little lost on what I can do.
Any ideas?
You probably use CGI.pm or something else that calls $r-read(). This
happends

in xs/Apache/RequestIO/Apache__RequestIO.h (hint grep the mod_perl source
code):

/*
 * XXX: as stated in ap_get_client_block, the real
 * error gets lots, so we only know that there was one
 */
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r-server,
 mod_perl: $r-read failed to read);
break;
As you can see from the comment due to a bad implementation of
ap_get_client_block in Apache, the error is not available. I'm planning to
rewrite all these functions to get rid of ap_get_client_block, and work
with

bucket brigades instead.

In any case that won't solve the problem that you are seeing, I'd dig in
Apache. e.g. trying to use mod_cgi (which doesn't use ap_get_client_block)
to

reproduce the problem and ask at the httpd list.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




--

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Apache Error of $r-read failed to read

2003-05-29 Thread Chris Faust



Hi,

We have been having some problems where all of a 
sudden apache will start logging the error of:

[error] mod_perl: $r-read failed to 
read

Multiple times (100s in less then 10th ofa 
sec), often it will get to the point where load on the machine goes through the 
roof and apache has problems responding and it appears to be the number of 
requests that are happening as limits that shouldn't be reached like DB 
connections and apache processes are maxing out during non-peak 
hours.

From what we could see it looked like someone 
outside was sending all kind of linefeeds and whatnot within the URL which was 
documented in the Apache 45 release which we did update - now we are down to 
getting the above mod_perl error and shortly after that starts all hell breaks 
loose.

Nowhere in our code do we directly call the "read" 
method nor can I find anything relating to the error so I'm a little lost on 
what I can do.

Any ideas?

Thanks
-Chris

RH Linux 8
Apache 2.0.45
mod_perl 1.99.05

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

See Above

2. Used Components and their 
Configuration:

*** using 
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Apache/BuildConfig.pm*** 
Makefile.PL options: MP_APXS 
= /usr/sbin/apxs MP_GENERATE_XS = 1 
MP_LIBNAME = mod_perl 
MP_USE_DSO = 1 MP_USE_STATIC = 
1

*** The httpd binary was not found

*** /usr/bin/perl -VSummary of my perl5 (revision 5.0 version 8 
subversion 0) configuration: Platform: 
osname=linux, osvers=2.4.18-11smp, 
archname=i386-linux-thread-multi uname='linux 
daffy.perf.redhat.com 2.4.18-11smp #1 smp thu aug 15 06:41:59 edt 2002 i686 i686 
i386 gnulinux ' config_args='-des -Doptimize=-O2 
-march=i386 -mcpu=i686 -Dmyhostname=localhost [EMAIL PROTECTED] -Dcc=gcc 
-Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux 
-Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads 
-Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow 
-Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 
-Uversiononly -Dpager=/usr/bin/less -isr' 
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 
-march=i386 -mcpu=i686', cppflags='-D_REENTRANT 
-D_GNU_SOURCE -fno-strict-aliasing -I/usr/include/gdbm' 
ccversion='', gccversion='3.2 20020822 (Red Hat Linux Rawhide 3.2-5)', 
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 -lgdbm -ldb -ldl -lm -lpthread -lc 
-lcrypt -lutil perllibs=-lnsl -ldl -lm -lpthread -lc 
-lcrypt -lutil libc=/lib/libc-2.2.92.so, so=so, 
useshrplib=true, libperl=libperl.so 
gnulibc_version='2.2.92' 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 
Sep 1 2002 23:56:49 %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 Wed May 28 19:16:35 2003 GMT.

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


Re: Apache Error of $r-read failed to read

2003-05-29 Thread Stas Bekman
Chris Faust wrote:
Hi,
 
We have been having some problems where all of a sudden apache will 
start logging the error of:
 
[error] mod_perl: $r-read failed to read
 
Multiple times (100s in less then 10th of a sec), often it will get to 
the point where load on the machine goes through the roof and apache has 
problems responding and it appears to be the number of requests that are 
happening as limits that shouldn't be reached like DB connections and 
apache processes are maxing out during non-peak hours.
 
 From what we could see it looked like someone outside was sending all 
kind of linefeeds and whatnot within the URL which was documented in the 
Apache 45 release which we did update - now we are down to getting the 
above mod_perl error and shortly after that starts all hell breaks loose.
 
Nowhere in our code do we directly call the read method nor can I find 
anything relating to the error so I'm a little lost on what I can do.
 
Any ideas?
You probably use CGI.pm or something else that calls $r-read(). This happends 
in xs/Apache/RequestIO/Apache__RequestIO.h (hint grep the mod_perl source code):

/*
 * XXX: as stated in ap_get_client_block, the real
 * error gets lots, so we only know that there was one
 */
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r-server,
 mod_perl: $r-read failed to read);
break;
As you can see from the comment due to a bad implementation of 
ap_get_client_block in Apache, the error is not available. I'm planning to 
rewrite all these functions to get rid of ap_get_client_block, and work with 
bucket brigades instead.

In any case that won't solve the problem that you are seeing, I'd dig in 
Apache. e.g. trying to use mod_cgi (which doesn't use ap_get_client_block) to 
reproduce the problem and ask at the httpd list.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com