“Call to undefined method” after apache reload using apc opcode cache

拈花ヽ惹草 提交于 2019-12-08 04:05:57

问题


we are using php5.4, apc 3.1.13 with apache2 and mod_php and have every now and then the problem that apc opcode cache seems to forget cached data after a apache reload (for example after a logrotate). This results sometimes in fatal errors with "Call to undefined method". We do not change the files in any way before the error occurs, and after an apache restart the problem is gone.

When we release a new version of our code, we have the next and the current version of our application in the filesystem and switch them via unlink the current and symlink the new version. I think this way apc adds the new opcodes (from a different location in the filesystem) to the cache and does not remove the old ones.

After some tests on a testsystem I can see that apc clears the cache after both an apache reload and apache restart. The "Call to undefined method" problems somehow sound like a fragmentation error but I really don't understand this because the cache should be empty because of the reload. I found some infos about a bug in an older apc version that should be fixed since years.

It's really hard for me to guess after how many apache reloads and applucation releases the apc ends with such a corrupt cache because I don't see a pattern. But it has definitely something to do with the apache reload.

Here is our apc.ini:

apc.enabled=1
apc.shm_size=512M
apc.num_files_hint=10000
apc.user_entries_hint=10000
apc.max_file_size=5M
apc.stat=1
apc.optimization=0
apc.shm_segments=1
apc.enable_cli=0
apc.cache_by_default=1
apc.include_once_override=0

I can see that the systems (debian) shared memory max is set to 32mb.

来源:https://stackoverflow.com/questions/27105077/call-to-undefined-method-after-apache-reload-using-apc-opcode-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!