com php-src: Fixed race condition in opcache restart: ext/opcache/ZendAccelerator.c
| From: | Dmitry Stogov | Date: | Wed, 22 May 2019 21:20:35 +0000 |
| Subject: | com php-src: Fixed race condition in opcache restart: ext/opcache/ZendAccelerator.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106297@lists.php.net to get a copy of this message | ||
Commit: fa6a4483e63d87608a839d04c6e1b9eed9a0430f
Author: Dmitry Stogov <dmitry@zend.com> Thu, 23 May 2019 00:20:35 +0300
Parents: 96404eb8e223bde0f5f697987a81acb640cc539f
Branches: PHP-7.2 PHP-7.3 PHP-7..4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fa6a4483e63d87608a839d04c6e1b9eed9a0430f
Log:
Fixed race condition in opcache restart
Changed paths:
M ext/opcache/ZendAccelerator.c
Diff:
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 34e4ef0..302a3c2 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -2164,8 +2164,6 @@ static void accel_reset_pcre_cache(void)
static void accel_activate(void)
{
- zend_bool reset_pcre = 0;
-
if (!ZCG(enabled) || !accel_startup_ok) {
return;
}
@@ -2271,9 +2269,6 @@ static void accel_activate(void)
accel_restart_leave();
}
}
- if (!ZCG(pcre_reseted)) {
- reset_pcre = 1;
- }
zend_shared_alloc_unlock();
}
@@ -2282,7 +2277,7 @@ static void accel_activate(void)
SHM_PROTECT();
HANDLE_UNBLOCK_INTERRUPTIONS();
- if (ZCSG(last_restart_time) != ZCG(last_restart_time)) {
+ if (ZCG(accelerator_enabled) && ZCSG(last_restart_time) != ZCG(last_restart_time)) {
/* SHM was reinitialized. */
ZCG(last_restart_time) = ZCSG(last_restart_time);
@@ -2291,7 +2286,7 @@ static void accel_activate(void)
accel_reset_pcre_cache();
ZCG(pcre_reseted) = 0;
- } else if (reset_pcre) {
+ } else if (!ZCG(accelerator_enabled) && !ZCG(pcre_reseted)) {
accel_reset_pcre_cache();
ZCG(pcre_reseted) = 1;
}