Skip to content

Commit 3e9792f

Browse files
Mikhail Galaniniluuu1994
Mikhail Galanin
authored andcommitted
Check if restart is pending before trying to lock SHM
This reduces lock contention when Opcache restart is scheduled but not yet started. Closes GH-11805
1 parent b5f8a72 commit 3e9792f

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ PHP NEWS
2121
- Opcache:
2222
. Fixed bug GH-11715 (opcache.interned_strings_buffer either has no effect or
2323
opcache_get_status() / phpinfo() is wrong). (nielsdos)
24+
. Avoid adding an unnecessary read-lock when loading script from shm if
25+
restart is in progress. (mikhainin)
2426

2527
- Standard:
2628
. Prevent int overflow on $decimals in number_format. (Marc Bennewitz)

ext/opcache/zend_file_cache.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,6 +1786,7 @@ zend_persistent_script *zend_file_cache_script_load(zend_file_handle *file_handl
17861786

17871787
if (!file_cache_only &&
17881788
!ZCSG(restart_in_progress) &&
1789+
!ZCSG(restart_pending) &&
17891790
!ZSMMG(memory_exhausted) &&
17901791
accelerator_shm_read_lock() == SUCCESS) {
17911792
/* exclusive lock */

0 commit comments

Comments
 (0)