Skip to content

Commit fa6a448

Browse files
committed
Fixed race condition in opcache restart
1 parent 96404eb commit fa6a448

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,8 +2164,6 @@ static void accel_reset_pcre_cache(void)
21642164

21652165
static void accel_activate(void)
21662166
{
2167-
zend_bool reset_pcre = 0;
2168-
21692167
if (!ZCG(enabled) || !accel_startup_ok) {
21702168
return;
21712169
}
@@ -2271,9 +2269,6 @@ static void accel_activate(void)
22712269
accel_restart_leave();
22722270
}
22732271
}
2274-
if (!ZCG(pcre_reseted)) {
2275-
reset_pcre = 1;
2276-
}
22772272
zend_shared_alloc_unlock();
22782273
}
22792274

@@ -2282,7 +2277,7 @@ static void accel_activate(void)
22822277
SHM_PROTECT();
22832278
HANDLE_UNBLOCK_INTERRUPTIONS();
22842279

2285-
if (ZCSG(last_restart_time) != ZCG(last_restart_time)) {
2280+
if (ZCG(accelerator_enabled) && ZCSG(last_restart_time) != ZCG(last_restart_time)) {
22862281
/* SHM was reinitialized. */
22872282
ZCG(last_restart_time) = ZCSG(last_restart_time);
22882283

@@ -2291,7 +2286,7 @@ static void accel_activate(void)
22912286

22922287
accel_reset_pcre_cache();
22932288
ZCG(pcre_reseted) = 0;
2294-
} else if (reset_pcre) {
2289+
} else if (!ZCG(accelerator_enabled) && !ZCG(pcre_reseted)) {
22952290
accel_reset_pcre_cache();
22962291
ZCG(pcre_reseted) = 1;
22972292
}

0 commit comments

Comments
 (0)