From a4accc0e3e14bce27f4aaf1f6ab060aa8f4a27ec Mon Sep 17 00:00:00 2001 From: Alexander Polyakov Date: Fri, 13 Jan 2017 14:55:10 +0300 Subject: [PATCH 1/2] opcache: print restart reason --- ext/opcache/ZendAccelerator.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 0351729b4f8..8e3bbade59a 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -2921,11 +2921,18 @@ void accel_shutdown(void) void zend_accel_schedule_restart(zend_accel_restart_reason reason) { + const char *zend_accel_restart_reason_text[ACCEL_RESTART_USER + 1] = { + "out of memory", + "hash overflow", + "user", + }; + if (ZCSG(restart_pending)) { /* don't schedule twice */ return; } - zend_accel_error(ACCEL_LOG_DEBUG, "Restart Scheduled!"); + zend_accel_error(ACCEL_LOG_DEBUG, "Restart Scheduled! Reason: %s", + zend_accel_restart_reason_text[reason]); SHM_UNPROTECT(); ZCSG(restart_pending) = 1; From fbf655afbd1cc5b5a9c9e03405c62ae714425435 Mon Sep 17 00:00:00 2001 From: Mitch Hagstrand Date: Fri, 13 Jan 2017 16:33:05 -0800 Subject: [PATCH 2/2] Added test for "opcache: print restart reason" to basic_logging.phpt --- ext/opcache/tests/basic_logging.phpt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/opcache/tests/basic_logging.phpt b/ext/opcache/tests/basic_logging.phpt index 4a571b5b93c..f0ecd6fbaa7 100644 --- a/ext/opcache/tests/basic_logging.phpt +++ b/ext/opcache/tests/basic_logging.phpt @@ -14,7 +14,11 @@ opcache.log_verbosity_level=4 --FILE-- --EXPECTF-- %s Message Cached script '%sbasic_logging%s' Foo Bar +%s Debug Restart Scheduled! Reason: user +Opcache reset