【问题标题】:What does the cryptic GC cache entry mean神秘的 GC 缓存条目是什么意思
【发布时间】:2011-06-07 02:41:05
【问题描述】:

有时,我会收到这条奇怪的警告信息。它通常在页面重新加载时消失。那是什么意思。我用谷歌搜索但无济于事。

Warning: include(): GC cache entry '/.../...class.php' (dev=2049 ino=37120489) was on gc-list for 3840 seconds in /.../...class.php on line 111

【问题讨论】:

标签: php warnings apc


【解决方案1】:

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

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 integer

缓存条目可以保留在垃圾收集列表中的秒数。如果服务器进程在执行缓存的源文件时死掉,该值提供了故障保护;如果该源文件被修改,为旧版本分配的内存将不会被回收,直到达到这个 TTL。设置为零以禁用此功能。

我们收到消息“GC 缓存条目 '%s' (dev=%d ino=%d) 在 gc-list 上持续了 %d 秒”或“GC 缓存条目 '%s' 在 gc-list 上持续了 % d 秒”在这种情况下:

(gc_sec &gt; cache-&gt;gc_ttl) &amp;&amp; (dead-&gt;value-&gt;ref_count &gt; 0)

第一个条件意味着,项目在 apc.gc_ttl 秒前被删除并且它仍然在垃圾收集器列表中。秒条件意味着,项目仍然被引用。

例如当进程意外死亡时,引用不会减少。首先 apc.ttl 秒在 APC 缓存中处于活动状态,然后被删除(此项目没有下一次命中)。现在项目在垃圾收集器列表 (GC) 上,并且 apc.gc_ttl 超时正在运行。当 apc.gc_ttl 小于那时(现在 - item_deletion_time)时,将写入警告并完全刷新项目。

尝试检查您的日志(Web 服务器、php、系统/内核)是否存在严重错误,例如php,网络服务器段错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    • 2012-08-15
    • 2012-09-18
    • 2023-03-25
    • 1970-01-01
    • 2014-04-19
    相关资源
    最近更新 更多