Process Control Limit Logging Question

5 posts / 0 new
Last post
#1 Thu, 11/24/2011 - 10:04
PaliGap

Process Control Limit Logging Question

Greetings!

I am testing Apache process control. I have gone to the virtual server >> configure web site >> processes & limits and as a test I have set Process limit to 1 and 1 i.e. "RLimitNPROC 1 1" in httpd.conf.

I have made a little Perl CGI script that sleeps for 30 seconds. If I run that, and while it's running I try reloading, sure enough the process limit works (but see below*). However in the virtual server logs I only see the generic error "Premature end of script headers: test.cgi" (and also "suexec policy violation: see suexec log for more details". And there's nothing in /var/log/httpd/error_log.

Is there a way I can get an error logged somewhere such that the error message refers to exceeding the RLimitNPROC limit? (and other limits I may use such as RLimitCPU). That way I can "tune" the server as time goes by so as to set a sensible limit. Otherwise I may find that the server's process limits are too fierce.

  • One thing I don't understand: While the perl script is running, if I load the HTML home page simultaneously, I'd expect that to stall (process limit of 1 exceeded). But it loads just fine!
Thu, 11/24/2011 - 12:12
andreychek

Howdy,

The process limits prevent suexec from spawning additional processes, but it'll still try to do so.

What you'll see then is "Resource unavailable" sorts of errors in your suexec log. Now, you could always review your suexec log for that error, and then tune things if necessary if you see that occurring a lot.

As far as viewing an HTML page -- I'm not sure that Apache is spawning a new process in order to retrieve an HTML file. It should only need to spawn a new process in order to run CGI code, such as Perl or PHP scripts. So, those limits aren't in effect when dealing with static content.

-Eric

Fri, 11/25/2011 - 05:53
PaliGap

I'm afraid I don't see "Resource unavailable" sorts of errors in the suexec log. In fact I have tried setting Apache LogLevel to 'debug', and the best I get is e.g. "failed to setuid (509: test.cgi)". And of course that doesn't tell me the cause of the problem (in this case - RLimitNPROC limit exceeded.

Fri, 11/25/2011 - 09:15
andreychek

Yeah, it's possible that's the best error you're going to get.

Though, one other thing you could try is to use /etc/security/limits.conf for setting resource limits. Here's an example of how you could set a user to be allowed just 25 processes, assuming that the user and group names are "example":

example hard nproc 25 @example hard nproc 25

I'm not sure that'll produce a better error message for you, but it'd at least give you something else to compare to just in case :-)

-Eric

Fri, 11/25/2011 - 10:11
PaliGap

Thanks Eric - I'll give it a go.

Topic locked