From 570ead36017377a6b81ac4234dac13f8f905f596 Mon Sep 17 00:00:00 2001 From: Mikhail Galanin Date: Thu, 27 Jul 2023 12:54:29 +0100 Subject: [PATCH] Check if restart is pending before trying to lock SHM This reduces lock contention when Opcache restart is scheduled but not yet started. --- ext/opcache/zend_file_cache.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 22ccc4d84305d..bcee38079b353 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -1786,6 +1786,7 @@ zend_persistent_script *zend_file_cache_script_load(zend_file_handle *file_handl if (!file_cache_only && !ZCSG(restart_in_progress) && + !ZCSG(restart_pending) && !ZSMMG(memory_exhausted) && accelerator_shm_read_lock() == SUCCESS) { /* exclusive lock */