Changes with Apache 2.1.0-dev
[Remove entries to the current 2.0 section below, when backported]
+ *) Fix segfault in mod_mem_cache cache_insert() due to cache size
+ becoming negative. PR: 21285, 21287
+ [Bill Stoddard, Massimo Torquati, Jean-Jacques Clar]
*) Add Polish translation of error messages. PR 25101.
[Tomasz Kepczynski <tomek jot23.org>]
if (sconf->lock) {
apr_thread_mutex_lock(sconf->lock);
}
- cache_remove(sconf->cache_cache, obj);
+ if (obj->cleanup) {
+ /* If obj->cleanup is set, the object has been prematurly
+ * ejected from the cache by the garbage collector. Add the
+ * object back to the cache. If an object with the same key is
+ * found in the cache, eject it in favor of the completed obj.
+ */
+ cache_object_t *tmp_obj =
+ (cache_object_t *) cache_find(sconf->cache_cache, obj->key);
+ if (tmp_obj) {
+ cache_remove(sconf->cache_cache, tmp_obj);
+ sconf->object_cnt--;
+ sconf->cache_size -= mobj->m_len;
+ tmp_obj->cleanup = 1;
+ if (!tmp_obj->refcount) {
+ cleanup_cache_object(tmp_obj);
+ }
+ }
+ obj->cleanup = 0;
+ }
+ else {
+ cache_remove(sconf->cache_cache, obj);
+ }
mobj->m_len = obj->count;
cache_insert(sconf->cache_cache, obj);
sconf->cache_size -= (mobj->m_len - obj->count);