Browse Source

fixed #279: segv on cache full

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@900 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 10 years ago
parent
commit
dd0f96a141
  1. 20
      xcache.c

20
xcache.c

@ -839,7 +839,7 @@ static inline void xc_entry_unholds_real(xc_stack_t *holds, xc_cache_t **caches,
while (xc_stack_count(s)) {
entry_php = (xc_entry_php_t *) xc_stack_pop(s);
TRACE("unhold %d:%s", entry_php->file_inode, entry_php->entry.name.str.val);
entry_php->refcount ++;
--entry_php->refcount;
assert(entry_php->refcount >= 0);
}
} LEAVE_LOCK(cache);
@ -1939,11 +1939,16 @@ static zend_op_array *xc_compile_file_ex(xc_compiler_t *compiler, zend_file_hand
if (stored_php) {
compiler->new_entry.php = stored_php;
xc_php_addref_unlocked(stored_php);
xc_entry_php_init(&compiler->new_entry, compiler->opened_path TSRMLS_CC);
stored_entry = xc_entry_php_store_unlocked(cache, compiler->entry_hash.entryslotid, &compiler->new_entry TSRMLS_CC);
TRACE(" cached %d:%s, holding", compiler->new_entry.file_inode, stored_entry->entry.name.str.val);
xc_entry_hold_php_unlocked(cache, stored_entry TSRMLS_CC);
if (stored_entry) {
xc_php_addref_unlocked(stored_php);
TRACE(" cached %d:%s, holding", compiler->new_entry.file_inode, stored_entry->entry.name.str.val);
xc_entry_hold_php_unlocked(cache, stored_entry TSRMLS_CC);
}
else {
gaveup = 1;
}
break;
}
@ -2021,10 +2026,11 @@ static zend_op_array *xc_compile_file_ex(xc_compiler_t *compiler, zend_file_hand
}
/* entry_store */
compiler->new_entry.php = stored_php;
xc_php_addref_unlocked(stored_php);
stored_entry = xc_entry_php_store_unlocked(cache, compiler->entry_hash.entryslotid, &compiler->new_entry TSRMLS_CC);
if (!stored_entry) {
xc_php_release_unlocked(cache, stored_php);
if (stored_entry) {
xc_php_addref_unlocked(stored_php);
TRACE(" cached %d:%s, holding", compiler->new_entry.file_inode, stored_entry->entry.name.str.val);
xc_entry_hold_php_unlocked(cache, stored_entry TSRMLS_CC);
}
} LEAVE_LOCK_EX(cache);
/* }}} */

Loading…
Cancel
Save