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 @@ -774,14 +774,15 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
774
774
/* so that other process won't try to force while we are busy cleaning up */
775
775
ZCSG (force_restart_time ) = 0 ;
776
776
while (mem_usage_check -> l_pid > 0 ) {
777
- /* Clear previous errno, reset success and tries */
777
+ /* Try SIGTERM first, switch to SIGKILL if not successful. */
778
+ int signal = SIGTERM ;
778
779
errno = 0 ;
779
780
success = 0 ;
780
781
tries = 10 ;
781
782
782
783
while (tries -- ) {
783
784
zend_accel_error (ACCEL_LOG_WARNING , "Attempting to kill locker %d" , mem_usage_check -> l_pid );
784
- if (kill (mem_usage_check -> l_pid , SIGKILL )) {
785
+ if (kill (mem_usage_check -> l_pid , signal )) {
785
786
if (errno == ESRCH ) {
786
787
/* Process died before the signal was sent */
787
788
success = 1 ;
@@ -800,6 +801,8 @@ static inline void kill_all_lockers(struct flock *mem_usage_check)
800
801
break ;
801
802
}
802
803
usleep (10000 );
804
+ /* If SIGTERM was not sufficient, use SIGKILL. */
805
+ signal = SIGKILL ;
803
806
}
804
807
if (!success ) {
805
808
/* 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