Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the cryptic GC cache entry mean

Tags:

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
like image 697
Josef Sábl Avatar asked Jan 11 '11 11:01

Josef Sábl


1 Answers

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.

like image 73
tatra Avatar answered Oct 01 '22 17:10

tatra