Download | Plain Text | No Line Numbers


  1. diff -Naur a/sapi/fpm/fpm/fpm_children.h b/sapi/fpm/fpm/fpm_children.h
  2. --- a/sapi/fpm/fpm/fpm_children.h 2018-07-31 16:33:06.000000000 +0200
  3. +++ b/sapi/fpm/fpm/fpm_children.h 2018-08-03 19:34:37.985592103 +0200
  4. @@ -32,6 +32,7 @@
  5. pid_t pid;
  6. int scoreboard_i;
  7. struct zlog_stream *log_stream;
  8. + int sigterm_sent;
  9. };
  10.  
  11. #endif
  12. diff -Naur a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c
  13. --- a/sapi/fpm/fpm/fpm_process_ctl.c 2018-07-31 16:33:06.000000000 +0200
  14. +++ b/sapi/fpm/fpm/fpm_process_ctl.c 2018-08-03 19:34:37.985592103 +0200
  15. @@ -52,6 +52,7 @@
  16.  
  17. static void fpm_pctl_action(struct fpm_event_s *ev, short which, void *arg) /* {{{ */
  18. {
  19. + ev->flags &= ~FPM_EV_PERSIST;
  20. fpm_pctl(FPM_PCTL_STATE_UNSPECIFIED, FPM_PCTL_ACTION_TIMEOUT);
  21. }
  22. /* }}} */
  23. @@ -60,6 +61,7 @@
  24. {
  25. fpm_event_set_timer(&pctl_event, 0, &fpm_pctl_action, NULL);
  26. fpm_event_add(&pctl_event, sec * 1000);
  27. + pctl_event.flags |= FPM_EV_PERSIST;
  28. return 0;
  29. }
  30. /* }}} */
  31. @@ -135,6 +137,9 @@
  32. case FPM_PCTL_QUIT :
  33. s = SIGQUIT;
  34. break;
  35. + case FPM_PCTL_KILL :
  36. + s = SIGKILL;
  37. + break;
  38. default :
  39. break;
  40. }
  41. diff -Naur a/sapi/fpm/fpm/fpm_process_ctl.h b/sapi/fpm/fpm/fpm_process_ctl.h
  42. --- a/sapi/fpm/fpm/fpm_process_ctl.h 2018-07-31 16:33:05.000000000 +0200
  43. +++ b/sapi/fpm/fpm/fpm_process_ctl.h 2018-08-03 19:34:37.986592093 +0200
  44. @@ -45,7 +45,8 @@
  45. FPM_PCTL_TERM,
  46. FPM_PCTL_STOP,
  47. FPM_PCTL_CONT,
  48. - FPM_PCTL_QUIT
  49. + FPM_PCTL_QUIT,
  50. + FPM_PCTL_KILL
  51. };
  52.  
  53. #endif
  54. diff -Naur a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c
  55. --- a/sapi/fpm/fpm/fpm_request.c 2018-07-31 16:33:05.000000000 +0200
  56. +++ b/sapi/fpm/fpm/fpm_request.c 2018-08-03 19:34:37.986592093 +0200
  57. @@ -272,7 +272,8 @@
  58. #endif
  59. if (terminate_timeout && tv.tv_sec >= terminate_timeout) {
  60. str_purify_filename(purified_script_filename, proc.script_filename, sizeof(proc.script_filename));
  61. - fpm_pctl_kill(child->pid, FPM_PCTL_TERM);
  62. + fpm_pctl_kill(child->pid, (child->sigterm_sent) ? FPM_PCTL_KILL : FPM_PCTL_TERM);
  63. + child->sigterm_sent = 1;
  64.  
  65. zlog(ZLOG_WARNING, "[pool %s] child %d, script '%s' (request: \"%s %s%s%s\") execution timed out (%d.%06d sec), terminating",
  66. child->wp->config->name, (int) child->pid, purified_script_filename, proc.request_method, proc.request_uri,
  67.