Re: Problem with long http request generation time - process restarting

"Randolf Richardson" <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Organization Inter-Corporate Computer & Network Services
Message-ID <[email protected]>
> Hi --
> 
> I am getting the following message recurring in my log:
> 
> Parent: child process exited with status 255 -- Restarting.
> 
> followed by the process restart sequence.
> 
> I have tracked it down to a call to $r->content which doesn't seem to
> return properly.
> 
> It would appear that
> 
> 1. The POST request has Encoding-type: chunked (message total length is
> ~5kb);
> 
> 2. The client sends the HTTP headers, then pauses 3-4 seconds while it
> generates the body of the message (confirmed with WireShark);
> 
> 3. So when I call $r-content, when it succeeds I see a 3-4 second pause
> before it completes;
> 
> 4. If another request arrives during the call to $r->content, the process
> aborts and restarts - I assume it is interfering with the read() call in
> $r->content.
> 
> Since the pause is so long, it is very likely to be interrupted even though
> I only have 5 clients currently :(
> 
> Given the the chunked implemenation in mod_perl 2.0 is apparently
> incomplete, have I struck one area where this affects the result?
> 
> Can anyone make suggestions as to how I can work around this problem?  I
> wondered about maybe moving my handler to the log phase (currently it's a
> Response handler), by which time I assume the entire message must be
> available, but it seems like a major kludge and presumably would lead to
> other issues anyway.

	I find it curious that you observe this behaviour within just under 
5 seconds.  The KeepAliveTimeout setting, which defaults to 5 
seconds, might be of interest to you -- I would certainly try setting 
it to 20 seconds temporarily in the hopes of at least ruling it out 
as a possible cause:

		http://httpd.apache.org/docs/2.2/mod/core.html#keepalivetimeout

> Or is there some multi-threading thing I should have done - currently I
> have not really done anything specific...
> 
> I am using Apache2.2 on Win7 (no flames please :)), with ActiveState Perl
> "(v5.12.2) built for MSWin32-x86-multi-thread".

	I have noticed that socket I/O under Windows behaves strangely at 
times.  I eventually moved off to running Apache HTTPd 2.2 with 
ModPerl 2 on NetBSD under VirtualBox, which basically seemed to cure 
all the unpredictable problems I encountered (not just with ModPerl 2 
but with other technologies, such as ImageMagick's PerlMagick 
libraries, even without ModPerl 2 in the mix, issues with compiling 
code downloaded from CPAN, etc.) as well as yielded better 
performance with faster response times.

	I found ActiveState Perl to be a great implementation, but one of 
the problems I had was that it sometimes didn't have a pre-compiled 
module that I needed, and moving to Unix was a lot easier.

	I mention those points in the hopes that it will be helpful to you 
(switching to Unix was helpful to a few of my friends who love PHP, 
and one who does a lot of xBase {Clipper} programming), and I hope 
you don't view this as a flame.

Randolf Richardson - [email protected]
Inter-Corporate Computer & Network Services, Inc.
Beautiful British Columbia, Canada
http://www.inter-corporate.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.