Php – Hanging page loads every n loads

apache-2.2hangingPHP

I recently moved my site to a new server (Apache 2, PHP5, MySQL5). The site is an Invision based forum. Every few posts / topics it just hangs. The data has been written because if you stop and reload, the post / thread is there. I thought it was a write issue initially, but nope. The data is written but the page load never completes. It doesn't leave the page where the data has been input.

What's the best way to troubleshoot this issue? The only thing I have done recently is reduce my MySQL timeouts, but I can't see that being an issue as the values are still big enough and there are no mentions of timeouts in the MySQL log. For the record there is nothing in PHP's error log either.

EDIT: I checked my server-status. It all looked ok, but I have a suspicion I was hitting my ServerLimit, so I doubled that. Also enabled my Keepalives. Will keep an eye on it.

EDIT 2: It's now been a few days and this is still occuring. I have more info though;

  1. Apache is throwing seg faults, but enabling core dumps does not produce them.
  2. I have tried disabling the modules in apache but it just stops things from working.
  3. I fear it may actually be DNS related. If I watch Live Headers in Firefox, absolutely nothing happens during this 'hanging' period. After that, the responses come back fairly promptly.

UPDATE (05/04): I built the latest versions of Apache and PHP from source, no luck. I then removed those and used the remi repo to update all my packages to the latest stable. Segfaults seem to have stopped, but the hanging is continuing.

ini's are at:

  • www.skylinesaustralia.com/php.ini
  • www.skylinesaustralia.com/my.cnf
  • www.skylinesaustralia.com/httpd.conf

UPDATE – SOLVED! – The issue was having a gigantic query cache size in MySQL. It was 2GB, changing it to 64M sorted it.

Best Answer

  1. Apache is throwing seg faults

There's your problem. Apache isn't hanging, your browser is hanging when apache's child dies and doesn't complete the request.

LogLevel debug may give you a bit more information (though, a ton of information if this is a busy production system).

My first guess would be suhosin/mod_security or something that is compiled against the wrong php api or possibly using shared libraries that have changed slightly. I'd doublecheck those and if you can isolate the different php extensions/apache modules that are running. Are you running apcc, eaccelerator or any opcode cache? Zend? Source Guardian? ioncube? Are you using the right version of each of these? Latest updates? Zend 3.3.9, ioncube had a recent update as well and can cause segfaults depending on the version of Zend you're running.

Related Topic