Apache Issue

Hi Guys,

I'm not sure if this is the right forum to post this but I am currently trying to troubleshoot an issue with Apache.

I'm not overly familiar with it, beyond it's initial setup it has worked fine for me for a year.

The issue manifested last night where connections to all my domains started timing out. I was still able to ssh in and access my webmin panel, just not any of the hosted domains.

I did a bit of combing of logs and got the following

PHP Warning:  file(http://www.principiadiscordia.com/list.html): failed to open stream: HTTP request failed!  in /var/www/principiadiscordia.com/index.php on line 4 failed to open stream: HTTP request failed!

I wasn't sure if this was related or if the issue was Apache. I performed a reboot of the machine.

For approximately 10 minutes everything seemed fine and then the pages timed out again.

I stopped apache via webmin, and restarted it, everything seemed nippy again.

The site went down about 20 minutes later, after I had gone to bed and stayed down till morning. Since then I've restarted apache 4 times and am trying to track down the root cause.

Some things I've seen in the logs that seem promising are:

When I restart apache

[error] server reached MaxClients setting, consider raising the MaxClients setting

When I use:

tail -f /var/log/apache2/error.log

I get

[Fri Feb 28 11:00:45 2014] [error] server reached MaxClients setting, consider raising the MaxClients setting
[Fri Feb 28 11:02:21 2014] [notice] caught SIGTERM, shutting down
[Fri Feb 28 11:02:25 2014] [notice] Apache/2.2.16 (Debian) PHP/5.3.3-7+squeeze18 with Suhosin-Patch configured -- resuming normal operations
[Fri Feb 28 11:02:26 2014] [error] server reached MaxClients setting, consider raising the MaxClients setting
[Fri Feb 28 11:14:53 2014] [notice] child pid 28220 exit signal Bus error (7)

I think sigterm is me restarting Apache, but I'm not sure if the rest are related.

So far all I really have to go on is the maxclients but I'm not certain.

As I said, I'm not sure if this is the forum to ask but if anyone has some suggestions or has seen something similar it would be very much appreciated.

Regards,

Faust

7 Replies

Ok I think I've isolated the problem, and I don't think it's apache.

Static Pages are loading, but php pages take a long time or completely fail.

[Fri Feb 28 11:00:45 2014] [error] server reached MaxClients setting, consider raising the MaxClients setting

^ Issue right there. PHP pages take longer so maxclients is reached earlier. With static pages, they're quickly handled so you won't get that issue. Your site has become busier/receives more traffic, that's why you're seeing it now, and not before.

You can try raising that value in your apache config, but it usually means more RAM usage as well.

Perfect,

I'll raise then number of clients and let you know how I get on.

Ok, that has helped a little: the site isn't becoming inaccessible any more. However I'm spotting paces that I get "The connection was reset"

Specifically in SMF when I try to access the package manager.

I upgraded to php5.3.3-7 about a week ago, I'm wondering if this could be related, but probably not an Apache thing.

PHP 5.3.3-7+squeeze18 with Suhosin-Patch (cli) (built: Dec 12 2013 09:20:04) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

Im seeing a lot of

child pid 10909 exit signal Segmentation fault (11)

Well are you monitoring your RAM? Are you sure you're not simply going oom now?

@Nuvini:

Well are you monitoring your RAM? Are you sure you're not simply going oom now?

I've given it a look with free -m

             total       used       free     shared    buffers     cached
Mem:         15999       2267      13731          0         57       1439
-/+ buffers/cache:        770      15228
Swap:        12286          0      12286

It isn't quite the exact amount I see from the webmin menu.

I've set my php.ini to safe mode and things are running stably again, so something in my configuration is the problem. Be it extensions or just my settings.

I think I'm getting closer and that it may have been two issues overlapping here.

If I find what the culprit is I'll post it.

If you are still getting timeouts, switching to fast-cgi/php-fpm for handling PHP might fix some issues as well. Apache is really inefficient at handing out dynamic content like php. Like others have said, as your traffic grows these problems with PHP will become more obvious and consistent.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct