神秘的 GC 缓存条目意味着什么
我时不时地收到这个奇怪的警告消息。它通常会在页面重新加载时消失。这意味着什么。我用谷歌搜索但没有结果。
Warning: include(): GC cache entry '/.../...class.php' (dev=2049 ino=37120489) was on gc-list for 3840 seconds in /.../...class.php on line 111
Time to time, I receive this strange warning message. It is usually gone on page reload. What does that mean. I googled but to no avail.
Warning: include(): GC cache entry '/.../...class.php' (dev=2049 ino=37120489) was on gc-list for 3840 seconds in /.../...class.php on line 111
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个问题肯定来自 APC,源代码来自包 apc-3.1.6-r1。当项目插入到用户缓存或文件缓存中时,将调用此函数。
从 APC 配置 ( http://cz.php.net/manual/ en/apc.configuration.php#ini.apc.gc-ttl )
apc.gc_ttl 整数
缓存条目可以在垃圾收集列表中保留的秒数。如果服务器进程在执行缓存的源文件时终止,此值可提供故障保护;如果该源文件被修改,则在达到此 TTL 之前,不会回收为旧版本分配的内存。设置为零可禁用此功能。
我们收到消息“GC 缓存条目 '%s' (dev=%d ino=%d) 在 gc-list 上持续 %d 秒”或“GC 缓存条目 '%s' 在 gc-list 上持续 %d 秒”在这种情况下:
(gc_sec > cache->gc_ttl) && (dead->value->ref_count>0)
第一个条件意味着,项目在 apc.gc_ttl 秒前被删除,并且仍在垃圾收集器列表中。秒条件意味着项目仍然被引用。
例如,当进程意外死亡时,引用不会减少。第一个 apc.ttl 秒在 APC 缓存中处于活动状态,然后被删除(该项目上没有下一个命中)。现在项目位于垃圾收集器列表 (GC) 上,并且 apc.gc_ttl 超时正在运行。当 apc.gc_ttl 小于(现在 - item_deletion_time)时,将写入警告并且项目将被完全刷新。
尝试检查您的日志(Web 服务器、PHP、系统/内核)是否存在严重错误,例如 PHP、Web 服务器段错误。
Definitely this issue goes from APC, source code from package apc-3.1.6-r1. When item is inserted into user cache or file cache, this function is called.
From APC configuration ( http://cz.php.net/manual/en/apc.configuration.php#ini.apc.gc-ttl )
apc.gc_ttl integer
The number of seconds that a cache entry may remain on the garbage-collection list. This value provides a fail-safe in the event that a server process dies while executing a cached source file; if that source file is modified, the memory allocated for the old version will not be reclaimed until this TTL reached. Set to zero to disable this feature.
We get messages "GC cache entry '%s' (dev=%d ino=%d) was on gc-list for %d seconds" or "GC cache entry '%s'was on gc-list for %d seconds" in this condition:
(gc_sec > cache->gc_ttl) && (dead->value->ref_count > 0)
First condition means, item was deleted later then apc.gc_ttl seconds ago and its still in garbage collector list. Seconds condition means, item is still referenced.
e.g. when process unexpectedly died, reference is not decreased. First apc.ttl seconds is active in APC cache, then is deleted (there isn't next hit on this item). Now item is on garbage collector list (GC) and apc.gc_ttl timeout is running. When apc.gc_ttl is less then (now - item_deletion_time), warning is written and item is completely flushed.
Try to check your logs (web server, php, system/kernel) to critical errors, e.g. php, web server segfault.