Changeset 979
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r978 r979 3 3 ======== 4 4 * chg: proto array xcache_clear_cache(int type, [ int id = -1 ]). -1 means all cache splits 5 6 Ini Settings Changes 7 ======== 8 * new: xcache.disable_on_crash = Off 9 5 10 ChangeLog 6 11 ======== 12 * closes #2: auto disable caching on crash 7 13 * closes #972: warning/error when XCache is loaded incorrectly 8 14 * closes #73: warn for improper PHP_FCGI_CHILDREN setting fcgi mode (>=PHP_5_3) -
trunk/NEWS
r974 r979 3 3 * improvements 4 4 * adds warning for misconfiguration 5 * auto disable caching on crash 5 6 6 7 2.0.1 2012-07-14 -
trunk/mmap.c
r924 r979 41 41 struct _xc_mmap_shm_t { 42 42 xc_shm_handlers_t *handlers; 43 zend_bool disabled; 43 44 void *ptr; 44 45 void *ptr_ro; -
trunk/xc_shm.h
r393 r979 6 6 struct _xc_shm_t { 7 7 const xc_shm_handlers_t *handlers; 8 zend_bool disabled; 8 9 }; 9 10 #define XC_SHM_IMPL _xc_shm_t -
trunk/xcache.c
r978 r979 70 70 static char *xc_mmap_path = NULL; 71 71 static char *xc_coredump_dir = NULL; 72 static zend_bool xc_disable_on_crash = 0; 72 73 73 74 static xc_hash_t xc_php_hcache = { 0 }; … … 87 88 static zend_ulong xc_var_size = 0; 88 89 90 static xc_shm_t *xc_shm = NULL; 89 91 static xc_cache_t **xc_php_caches = NULL; 90 92 static xc_cache_t **xc_var_caches = NULL; … … 2155 2157 || strstr(PG(include_path), "://") != NULL 2156 2158 #endif 2159 || xc_shm || xc_shm->disabled 2157 2160 ) { 2158 2161 TRACE("%s", "cacher not enabled"); … … 2304 2307 } 2305 2308 /* }}} */ 2306 static xc_shm_t *xc_cache_destroy(xc_cache_t **caches, xc_hash_t *hcache) /* {{{ */2309 static void xc_cache_destroy(xc_cache_t **caches, xc_hash_t *hcache) /* {{{ */ 2307 2310 { 2308 2311 size_t i; 2309 2312 xc_cache_t *cache; 2310 xc_shm_t *shm;2311 2313 2312 2314 if (!caches) { 2313 return NULL;2314 } 2315 shm = NULL; 2315 return; 2316 } 2317 2316 2318 for (i = 0; i < hcache->size; i ++) { 2317 2319 cache = caches[i]; … … 2326 2328 cache->mem->handlers->free(cache->mem, cache); 2327 2329 */ 2328 shm = cache->shm; 2329 shm->handlers->memdestroy(cache->mem); 2330 cache->shm->handlers->memdestroy(cache->mem); 2330 2331 } 2331 2332 } 2332 2333 free(caches); 2333 return shm;2334 2334 } 2335 2335 /* }}} */ … … 2387 2387 static void xc_destroy() /* {{{ */ 2388 2388 { 2389 xc_shm_t *shm = NULL;2390 2391 2389 if (old_compile_file) { 2392 2390 zend_compile_file = old_compile_file; … … 2400 2398 2401 2399 if (xc_php_caches) { 2402 shm =xc_cache_destroy(xc_php_caches, &xc_php_hcache);2400 xc_cache_destroy(xc_php_caches, &xc_php_hcache); 2403 2401 xc_php_caches = NULL; 2404 2402 } 2405 2403 2406 2404 if (xc_var_caches) { 2407 shm =xc_cache_destroy(xc_var_caches, &xc_var_hcache);2405 xc_cache_destroy(xc_var_caches, &xc_var_hcache); 2408 2406 xc_var_caches = NULL; 2409 2407 } 2410 2408 2411 if (shm) { 2412 xc_shm_destroy(shm); 2409 if (xc_shm) { 2410 xc_shm_destroy(xc_shm); 2411 xc_shm = NULL; 2413 2412 } 2414 2413 … … 2418 2417 static int xc_init(int module_number TSRMLS_DC) /* {{{ */ 2419 2418 { 2420 xc_shm_t *shm;2421 2419 xc_shmsize_t shmsize = ALIGN(xc_php_size) + ALIGN(xc_var_size); 2422 2420 2423 2421 xc_php_caches = xc_var_caches = NULL; 2424 shm = NULL;2422 xc_shm = NULL; 2425 2423 2426 2424 if (shmsize < (size_t) xc_php_size || shmsize < (size_t) xc_var_size) { … … 2430 2428 2431 2429 if (xc_php_size || xc_var_size) { 2432 CHECK( shm = xc_shm_init(xc_shm_scheme, shmsize, xc_readonly_protection, xc_mmap_path, NULL), "Cannot create shm");2433 if (! shm->handlers->can_readonly(shm)) {2430 CHECK(xc_shm = xc_shm_init(xc_shm_scheme, shmsize, xc_readonly_protection, xc_mmap_path, NULL), "Cannot create shm"); 2431 if (!xc_shm->handlers->can_readonly(xc_shm)) { 2434 2432 xc_readonly_protection = 0; 2435 2433 } … … 2439 2437 zend_compile_file = xc_compile_file; 2440 2438 2441 CHECK(xc_php_caches = xc_cache_init( shm, &xc_php_hcache, &xc_php_hentry, &xc_php_hentry, xc_php_size), "failed init opcode cache");2439 CHECK(xc_php_caches = xc_cache_init(xc_shm, &xc_php_hcache, &xc_php_hentry, &xc_php_hentry, xc_php_size), "failed init opcode cache"); 2442 2440 } 2443 2441 2444 2442 if (xc_var_size) { 2445 CHECK(xc_var_caches = xc_cache_init( shm, &xc_var_hcache, &xc_var_hentry, NULL, xc_var_size), "failed init variable cache");2443 CHECK(xc_var_caches = xc_cache_init(xc_shm, &xc_var_hcache, &xc_var_hentry, NULL, xc_var_size), "failed init variable cache"); 2446 2444 } 2447 2445 } … … 2453 2451 /* shm destroied in xc_destroy() */ 2454 2452 } 2455 else if ( shm) {2453 else if (xc_shm) { 2456 2454 xc_destroy(); 2457 xc_shm_destroy(shm); 2455 xc_shm_destroy(xc_shm); 2456 xc_shm = NULL; 2458 2457 } 2459 2458 return 0; … … 2519 2518 static void xc_request_shutdown(TSRMLS_D) /* {{{ */ 2520 2519 { 2521 xc_entry_unholds(TSRMLS_C); 2520 if (xc_shm && !xc_shm->disabled) { 2521 xc_entry_unholds(TSRMLS_C); 2522 xc_gc_expires_php(TSRMLS_C); 2523 xc_gc_expires_var(TSRMLS_C); 2524 xc_gc_deletes(TSRMLS_C); 2525 } 2522 2526 #ifdef ZEND_ENGINE_2 2523 2527 zend_llist_destroy(&XG(gc_op_arrays)); 2524 2528 #endif 2525 xc_gc_expires_php(TSRMLS_C);2526 xc_gc_expires_var(TSRMLS_C);2527 xc_gc_deletes(TSRMLS_C);2528 2529 #ifdef HAVE_XCACHE_COVERAGER 2529 2530 xc_coverager_request_shutdown(TSRMLS_C); … … 2709 2710 xcache_admin_auth_check(TSRMLS_C); 2710 2711 2711 if (!xc_initized ) {2712 if (!xc_initized || !xc_shm || xc_shm->disabled) { 2712 2713 RETURN_NULL(); 2713 2714 } … … 2867 2868 zval *name; 2868 2869 2869 if (!xc_var_caches ) {2870 if (!xc_var_caches || !xc_shm || xc_shm->disabled) { 2870 2871 VAR_DISABLED_WARNING(); 2871 2872 RETURN_NULL(); … … 2901 2902 zval *value; 2902 2903 2903 if (!xc_var_caches ) {2904 if (!xc_var_caches || !xc_shm || xc_shm->disabled) { 2904 2905 VAR_DISABLED_WARNING(); 2905 2906 RETURN_NULL(); … … 2943 2944 zval *name; 2944 2945 2945 if (!xc_var_caches ) {2946 if (!xc_var_caches || !xc_shm || xc_shm->disabled) { 2946 2947 VAR_DISABLED_WARNING(); 2947 2948 RETURN_FALSE; … … 2977 2978 zval *name; 2978 2979 2979 if (!xc_var_caches ) {2980 if (!xc_var_caches || !xc_shm || xc_shm->disabled) { 2980 2981 VAR_DISABLED_WARNING(); 2981 2982 RETURN_FALSE; … … 3007 3008 int i, iend; 3008 3009 3009 if (!xc_var_caches ) {3010 if (!xc_var_caches || !xc_shm || xc_shm->disabled) { 3010 3011 VAR_DISABLED_WARNING(); 3011 3012 RETURN_FALSE; … … 3043 3044 zval oldzval; 3044 3045 3045 if (!xc_var_caches ) {3046 if (!xc_var_caches || !xc_shm || xc_shm->disabled) { 3046 3047 VAR_DISABLED_WARNING(); 3047 3048 RETURN_NULL(); … … 3554 3555 } 3555 3556 } 3557 if (xc_disable_on_crash) { 3558 xc_disable_on_crash = 0; 3559 if (xc_shm) { 3560 xc_shm->disabled = 1; 3561 } 3562 } 3556 3563 raise(sig); 3557 3564 } … … 3610 3617 PHP_INI_ENTRY1 ("xcache.mmap_path", DEFAULT_PATH, PHP_INI_SYSTEM, xc_OnUpdateString, &xc_mmap_path) 3611 3618 PHP_INI_ENTRY1 ("xcache.coredump_directory", "", PHP_INI_SYSTEM, xc_OnUpdateString, &xc_coredump_dir) 3619 PHP_INI_ENTRY1 ("xcache.disable_on_crash", "0", PHP_INI_SYSTEM, xc_OnUpdateBool, &xc_disable_on_crash) 3612 3620 PHP_INI_ENTRY1 ("xcache.test", "0", PHP_INI_SYSTEM, xc_OnUpdateBool, &xc_test) 3613 3621 PHP_INI_ENTRY1 ("xcache.readonly_protection", "0", PHP_INI_SYSTEM, xc_OnUpdateBool, &xc_readonly_protection) -
trunk/xcache.ini
r927 r979 58 58 ; make sure it's writable by php (open_basedir is not checked) 59 59 xcache.coredump_directory = "" 60 ; disable cache after crash until restart. (non-Win32 only) 61 xcache.disable_on_crash = Off 60 62 61 63 ; enable experimental documented features for each release if available
Note: See TracChangeset
for help on using the changeset viewer.

