File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -767,14 +767,15 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
767
767
/* so that other process won't try to force while we are busy cleaning up */
768
768
ZCSG (force_restart_time ) = 0 ;
769
769
while (mem_usage_check -> l_pid > 0 ) {
770
- /* Clear previous errno, reset success and tries */
770
+ /* Try SIGTERM first, switch to SIGKILL if not successful. */
771
+ int signal = SIGTERM ;
771
772
errno = 0 ;
772
773
success = 0 ;
773
774
tries = 10 ;
774
775
775
776
while (tries -- ) {
776
777
zend_accel_error (ACCEL_LOG_WARNING , "Attempting to kill locker %d" , mem_usage_check -> l_pid );
777
- if (kill (mem_usage_check -> l_pid , SIGKILL )) {
778
+ if (kill (mem_usage_check -> l_pid , signal )) {
778
779
if (errno == ESRCH ) {
779
780
/* Process died before the signal was sent */
780
781
success = 1 ;
@@ -797,6 +798,8 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
797
798
break ;
798
799
}
799
800
usleep (10000 );
801
+ /* If SIGTERM was not sufficient, use SIGKILL. */
802
+ signal = SIGKILL ;
800
803
}
801
804
if (!success ) {
802
805
/* errno is not ESRCH or we ran out of tries to kill the locker */
You can’t perform that action at this time.
0 commit comments