2

I run a decently high-trafficked webserver (dedicated Apache/PHP), and while it works fine most of time, about once a day it dead-locks and refuses any new connections. Restarting Apache fixes the problem. I have caught it a few times right before this lockout, and Apache Status shows all W's (sending reply) for every request. The last error in the http-errors.log is that MaxClients was hit (which makes sense because no request is returning).

Do you guys have any ideas why an Apache request might decide to never return, or any thoughts on what could be going on here?

Thanks!

Harry
  • 221
  • 1
  • 5
  • 9
  • Have you tried to nail-down the problem by reducing MaxClients and turning on some extra debug logs? – Andrejs Cainikovs Sep 28 '10 at 18:47
  • It sounds like you simply need to tune your Apache configuration. If you need to troubleshoot a greater issue, look at: http://serverfault.com/q/43752/35817 – Warner Sep 28 '10 at 18:49

2 Answers2

7

It appears you have the dreaded Persistent Bush Syndrome (PBS for short)....which means you are stuck with way too many W's (sending reply). Luckily, there's is a very simple fix. The cause may be that your script is performing a long winded query that never completes. Check out this article, it explains how to fix diagnosis and track down the cause of connections stuck in "sending reply" status http://techmythsworld.blogspot.com/2011/11/solving-httpd-maxclients-and-modstatus.html

In short, you need to do the following: 1. Find the script that is getting stuck in W's and whatever is being posted to it (it might be very unique variables that cause it to get stuck.

  1. Ensure that you can recreate the situation by posting the causing variables to the script. You will see a connection show up from your ipaddress that will remain stuck in W.

  2. Track down if you have an loop or a database query that doesn't end.

  3. Fix the script. and repost the variables, you should see that the stuck in W for your ipaddress is gone.

PS. You must restart the webserver with every test to reset your connection (command "service httpd restart" should do

UEO
  • 86
  • 1
  • 2
1

I have also seen this issue when PHP-FPM wasn't functioning. Sites were down, and processes stayed in status 'W'. Restarting PHP-FPM solved the issue.