I think the below code from
memcache/apr_memcache.c::apr_memcache_find_server_hash_default can cause a
cache inconsistency.
If the server determined by the provided hash value is dead we just choose the
next one.
If we do this when writing and the previous dead server comes back with its
cache (cannot happen if it got restarted, but can
happen if there was a temporary network connectivity issue) the next read
operation might read a stale cache entry from this
resurrected dead server.
do {
ms = mc->live_servers[h % mc->ntotal];
if(ms->status == APR_MC_SERVER_LIVE) {
break;
}
else {
if (curtime == 0) {
curtime = apr_time_now();
}
#if APR_HAS_THREADS
apr_thread_mutex_lock(ms->lock);
#endif
/* Try the dead server, every 5 seconds */
if (curtime - ms->btime > apr_time_from_sec(5)) {
ms->btime = curtime;
if (mc_version_ping(ms) == APR_SUCCESS) {
make_server_live(mc, ms);
#if APR_HAS_THREADS
apr_thread_mutex_unlock(ms->lock);
#endif
break;
}
}
#if APR_HAS_THREADS
apr_thread_mutex_unlock(ms->lock);
#endif
}
h++;
i++;
} while(i < mc->ntotal);
Regards
RĂ¼diger