the script is a silly trivial example of how  a more complex script with a loop 
that is not obvious could cause a major issue.
the scripts ran indefinitely despite the timeout.  the server had to manually 
restarted.





________________________________
From: Jeroen Geilman [[email protected]]
Sent: Sunday, June 19, 2011 8:46 PM
To: [email protected]
Subject: Re: [users@httpd] What does Timeout in the httpd.conf file accomplish?

On 06/20/2011 02:38 AM, Zaccone, Warren wrote:
Running  multiple copies of this script concurrently brings httpd into a hang 
state, that it will not recover from without manually restarting the httpd 
server.

ab -n 300 -c 300 http://myserver/mysite/loop.php

You're requesting a single URL 300 times concurrently.
This means that apache has to dedicate 300 threads at once to this purpose.
this is a trivial test case.

If you're not running worker, and your minspare is lower than 250 or so, it's 
going to take MINUTES to even get to number 300.

As documented, when many new (prefork) threads are being requested at once, 
apache will only  spawn one per second, to protect itself from attacks and 
runaway processes.
the point is not how the situation was produced, but rather why aren't the 256 
workers that are running this script stoppe.  I know that I started more than 
300.

<?php
/*  loop.php */

while (1) sleep (20);

?>

And the request does nothing for 20 seconds before returning.

What exactly are you testing here ?

reproducing fact. that a single user of my server can bring down the server 
with a simple script.  running it from the unix command prompt is not 
realistic, but it is realistic that an automated script from another server 
could be doing so.
I have timeout set to 900 but it does not appear to be working.  What does 
timeout in the httpd.conf do?


As documented, Timeout determines the maximum number of seconds that a single 
request may take.

I am afraid not - each of the copies of httpd running the above script ran 
indefinitely.

Will the httpd.conf  timeout protect the server from such scripts or  is there 
something else.

Yes, Timeout works on the HTTP level, so everything sent over HTTP is affected 
by it.

This means everything.



I am configured using Prefork

Then that apachebench run you show above is bloody stupid.
please Explain?



settings are:

Timeout 900
MaxKeepAliveRequests 100
StartServers        5
MinSpareServers     5
MaxSpareServers     10
MaxClients          256


You can't even SERVE 300 concurrent requests.


MaxRequestsPerChild   0

Ok, so you have given me some useful advice here, unintentionally.   this value 
should not be 0?


If you run PHP, this kills apache.
Eventually.


# pstack 22040 (root)

You have no idea what you are doing.
This was entirely unnecessary.    Why do you say this.   I am reproducing an 
ellusive situation with a trival test case.., there is no reason to get 
personal.    I thought this forum was a place people could ask silly questions 
and not be attacked.




--
J.

Reply via email to