com php-src: Fixed process synchronisation problem, that may cause crashes after opcache restart: ext/opcache/ZendAccelerator.c
ext/opcache/ZendAccelerator.h ext/opcache/zend_accelerator_ module.c
| From: | Dmitry Stogov | Date: | Wed, 17 Feb 2016 10:58:05 +0000 |
| Subject: | com php-src: Fixed process synchronisation problem, that may cause crashes after opcache restart: ext/opcache/ZendAccelerator.c ext/opcache/ZendAccelerator.h ext/opcache/zend_accelerator_ module.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91076@lists.php.net to get a copy of this message | ||
Commit: d2287529396539fd2cba6f449ae9679cac64c3b9
Author: Dmitry Stogov <dmitry@zend.com> Wed, 17 Feb 2016 13:58:05 +0300
Parents: 6f6bd8ce531636134efd5f669a4e8373fb2e9e51
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d2287529396539fd2cba6f449ae9679cac64c3b9
Log:
Fixed process synchronisation problem, that may cause crashes after opcache restart
Changed paths:
M ext/opcache/ZendAccelerator.c
M ext/opcache/ZendAccelerator.h
M ext/opcache/zend_accelerator_module.c
Diff:
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 9e606f0..addfe87 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -2278,6 +2278,19 @@ static void zend_accel_fast_shutdown(void)
}
#endif
+int accel_post_deactivate(void)
+{
+ if (!ZCG(enabled) || !accel_startup_ok) {
+ return SUCCESS;
+ }
+
+ zend_shared_alloc_safe_unlock(); /* be sure we didn't leave cache locked */
+ accel_unlock_all();
+ ZCG(counted) = 0;
+
+ return SUCCESS;
+}
+
static void accel_deactivate(void)
{
/* ensure that we restore function_table and class_table
@@ -2294,10 +2307,6 @@ static void accel_deactivate(void)
return;
}
- zend_shared_alloc_safe_unlock(); /* be sure we didn't leave cache locked */
- accel_unlock_all();
- ZCG(counted) = 0;
-
#if !ZEND_DEBUG
if (ZCG(accel_directives).fast_shutdown && is_zend_mm()) {
zend_accel_fast_shutdown();
diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h
index ca2b9f6..89664a2 100644
--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -318,6 +318,7 @@ extern zend_accel_globals accel_globals;
extern char *zps_api_failure_reason;
void accel_shutdown(void);
+int accel_post_deactivate(void);
void zend_accel_schedule_restart(zend_accel_restart_reason reason);
void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason);
accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_t *size);
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index 894ea08..2fabc8c 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -516,7 +516,9 @@ static zend_module_entry accel_module_entry = {
NULL,
zend_accel_info,
ACCELERATOR_VERSION "FE",
- STANDARD_MODULE_PROPERTIES
+ NO_MODULE_GLOBALS,
+ accel_post_deactivate,
+ STANDARD_MODULE_PROPERTIES_EX
};
int start_accel_module(void)