5

I've recently switched my web server to Centos 6.3, with apache 2.2.15, PHP 5.4.11 and APC 3.1.14.

I started receiving complaints from customers from time to time, that a page is not working, or strange errors appear. I saw that the affected pages have question marks and other strange symbols in random places in the output, even though the sources are OK. When I change a single letter in the source file, the page starts working fine.

I suspect APC, but I cannot find any clue when and why this happens.

I use mercurial to push changes to production, but I've used this approach for years with no problem. Maybe something in the configuration is new now, but sadly I don't keep my old configuration.

Below is a screenshot from the last corruption.

screenshot from a corrupted ajax response

Edit: Here's the response after I've changed a single character in the source, saved it, and then undo the files (same is if I just restart the web server or clear APC opcode cache):

screenshot after a fix

Notice the line numbers didn't match, but it's 100% the same request, so the response should be the same also. The line 111 from the first screenshot should not be there at all. It seems that it's from another source file...

Jacket
  • 844
  • 10
  • 18
  • What charset is the page in? (Both meta header and server header?) What collation is the DB (if there is one) - does everything match? – Rich Bradshaw Jan 27 '13 at 20:08
  • Everything is UTF-8. If it was a charset issue, wouldn't it be a permanent problem? – Jacket Jan 27 '13 at 20:09
  • Most definitely. Wondered if it was something where usually it's OK, almost by coincidence, but an underlying issue was showing up with APC. When it's corrupted, it is always in the same place? (i.e. if you had refreshed that page, would it have been the same?) If you clear the APC cache, without changing anything else, is it still corrupted, and if so, again is it in the same place? – Rich Bradshaw Jan 27 '13 at 20:21
  • Is that text 'TotalBytesReceived' on the page normally, or has that magically appeared? – Rich Bradshaw Jan 27 '13 at 20:22
  • php 5.4.X seems not to be mature enough yet. – Itay Moav -Malimovka Jan 27 '13 at 20:27
  • 1
    If you refresh, the problematic output is in the same line(s). It's not affected by refreshes. TotalBytesReceived is an array key from the source file, but it's never meant to be printed or echoed anywhere... – Jacket Jan 27 '13 at 20:33

1 Answers1

0

I've changed apc.stat_ctime to 1

Verification with ctime will avoid problems caused by programs such as svn or rsync by making sure inodes haven't changed since the last stat. APC will normally only check mtime.

I'll be watching closely on the problem, because it's occurring once or twice a week and post here if this fixed it.

Jacket
  • 844
  • 10
  • 18