com php-src: Fix misleading error message in `ZendAccelerator.c`.: ext/opcache/ZendAccelerator.c
| From: | Christoph Michael Becker | Date: | Mon, 02 Dec 2019 09:06:32 +0000 |
| Subject: | com php-src: Fix misleading error message in `ZendAccelerator.c`.: ext/opcache/ZendAccelerator.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109342@lists.php.net to get a copy of this message | ||
Commit: b35acd30f2d15092717c222a4fcff838bfcb7b41
Author: Adam Saponara <as@php.net> Tue, 26 Nov 2019 17:21:16 -0500
Committer: Christoph M. Becker <cmbecker69@gmx.de> Mon, 2 Dec 2019 10:06:32 +0100
Parents: 2a742546bfb40fe241c5e5b972aeaa61a77fb634
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b35acd30f2d15092717c222a4fcff838bfcb7b41
Log:
Fix misleading error message in
ZendAccelerator.c.
Currently this error emits something like...
Error Cannot kill process 12345: Success!
..due to calling time before strerror which clears errno.
This
patch adds an error log immediately after both kill calls which gives
us better indication of what exactly failed.
Changed paths:
M ext/opcache/ZendAccelerator.c
Diff:
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 08fca1e3fa9..5cf1bced129 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -783,6 +783,8 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
/* Process died before the signal was sent */
success = 1;
zend_accel_error(ACCEL_LOG_WARNING, "Process %d died before SIGKILL was sent",
mem_usage_check->l_pid);
+ } else if (errno != 0) {
+ zend_accel_error(ACCEL_LOG_WARNING, "Failed to send SIGKILL to locker %d: %s",
mem_usage_check->l_pid, strerror(errno));
}
break;
}
@@ -793,6 +795,8 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
/* successfully killed locker, process no longer exists */
success = 1;
zend_accel_error(ACCEL_LOG_WARNING, "Killed locker %d", mem_usage_check->l_pid);
+ } else if (errno != 0) {
+ zend_accel_error(ACCEL_LOG_WARNING, "Failed to check locker %d: %s",
mem_usage_check->l_pid, strerror(errno));
}
break;
}
@@ -802,7 +806,7 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
/* errno is not ESRCH or we ran out of tries to kill the locker */
ZCSG(force_restart_time) = time(NULL); /* restore forced restart request */
/* cannot kill the locker, bail out with error */
- zend_accel_error(ACCEL_LOG_ERROR, "Cannot kill process %d: %s!",
mem_usage_check->l_pid, strerror(errno));
+ zend_accel_error(ACCEL_LOG_ERROR, "Cannot kill process %d!",
mem_usage_check->l_pid);
}
mem_usage_check->l_type = F_WRLCK;