神秘的 GC 缓存条目意味着什么

发布于 2024-10-11 03:09:30 字数 228 浏览 8 评论 0原文

我时不时地收到这个奇怪的警告消息。它通常会在页面重新加载时消失。这意味着什么。我用谷歌搜索但没有结果。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终陌 2024-10-18 03:09:30

这个问题肯定来自 APC,源代码来自包 apc-3.1.6-r1。当项目插入到用户缓存或文件缓存中时,将调用此函数。

static void process_pending_removals(apc_cache_t* cache TSRMLS_DC)
{
slot_t** slot;
time_t now;

/* This function scans the list of removed cache entries and deletes any
 * entry whose reference count is zero (indicating that it is no longer
 * being executed) or that has been on the pending list for more than
 * cache->gc_ttl seconds (we issue a warning in the latter case).
 */

if (!cache->header->deleted_list)
    return;

slot = &cache->header->deleted_list;
now = time(0);

while (*slot != NULL) {
    int gc_sec = cache->gc_ttl ? (now - (*slot)->deletion_time) : 0;

    if ((*slot)->value->ref_count <= 0 || gc_sec > cache->gc_ttl) {
        slot_t* dead = *slot;

        if (dead->value->ref_count > 0) {
            switch(dead->value->type) {
                case APC_CACHE_ENTRY_FILE:
                    apc_warning("GC cache entry '%s' (dev=%d ino=%d) was on gc-list for %d seconds" TSRMLS_CC,
                        dead->value->data.file.filename, dead->key.data.file.device, dead->key.data.file.inode, gc_sec);
                    break;
                case APC_CACHE_ENTRY_USER:
                    apc_warning("GC cache entry '%s'was on gc-list for %d seconds" TSRMLS_CC, dead->value->data.user.info, gc_sec);
                    break;
            }
        }
        *slot = dead->next;
        free_slot(dead TSRMLS_CC);
    }
    else {
        slot = &(*slot)->next;
    }
} 
}

从 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.

static void process_pending_removals(apc_cache_t* cache TSRMLS_DC)
{
slot_t** slot;
time_t now;

/* This function scans the list of removed cache entries and deletes any
 * entry whose reference count is zero (indicating that it is no longer
 * being executed) or that has been on the pending list for more than
 * cache->gc_ttl seconds (we issue a warning in the latter case).
 */

if (!cache->header->deleted_list)
    return;

slot = &cache->header->deleted_list;
now = time(0);

while (*slot != NULL) {
    int gc_sec = cache->gc_ttl ? (now - (*slot)->deletion_time) : 0;

    if ((*slot)->value->ref_count <= 0 || gc_sec > cache->gc_ttl) {
        slot_t* dead = *slot;

        if (dead->value->ref_count > 0) {
            switch(dead->value->type) {
                case APC_CACHE_ENTRY_FILE:
                    apc_warning("GC cache entry '%s' (dev=%d ino=%d) was on gc-list for %d seconds" TSRMLS_CC,
                        dead->value->data.file.filename, dead->key.data.file.device, dead->key.data.file.inode, gc_sec);
                    break;
                case APC_CACHE_ENTRY_USER:
                    apc_warning("GC cache entry '%s'was on gc-list for %d seconds" TSRMLS_CC, dead->value->data.user.info, gc_sec);
                    break;
            }
        }
        *slot = dead->next;
        free_slot(dead TSRMLS_CC);
    }
    else {
        slot = &(*slot)->next;
    }
} 
}

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文