Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flag harakiri-only-graceful #2600

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ void uwsgi_init_default() {
uwsgi.mule_msg_recv_size = 65536;

uwsgi.harakiri_graceful_signal = SIGTERM;

uwsgi.harakiri_only_graceful = 0;
}

void uwsgi_setup_reload() {
Expand Down
7 changes: 5 additions & 2 deletions core/master_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1681,9 +1681,12 @@ void trigger_harakiri(int i) {
} else {
kill(uwsgi.workers[i].pid, SIGKILL);
}
if (!uwsgi.workers[i].pending_harakiri)
if (!uwsgi.workers[i].pending_harakiri) {
uwsgi.workers[i].harakiri_count++;
uwsgi.workers[i].pending_harakiri++;
}
if (!uwsgi.harakiri_only_graceful) {
uwsgi.workers[i].pending_harakiri++;
}
}

}
Expand Down
1 change: 1 addition & 0 deletions core/uwsgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ static struct uwsgi_option uwsgi_base_options[] = {
{"harakiri-verbose", no_argument, 0, "enable verbose mode for harakiri", uwsgi_opt_true, &uwsgi.harakiri_verbose, 0},
{"harakiri-graceful-timeout", required_argument, 0, "interval between graceful harakiri attempt and a sigkill", uwsgi_opt_set_int, &uwsgi.harakiri_graceful_timeout, 0},
{"harakiri-graceful-signal", required_argument, 0, "use this signal instead of sigterm for graceful harakiri attempts", uwsgi_opt_set_int, &uwsgi.harakiri_graceful_signal, 0},
{"harakiri-only-graceful", required_argument, 0, "use only graceful harakiri", uwsgi_opt_true, &uwsgi.harakiri_only_graceful, 0},
{"harakiri-queue-threshold", required_argument, 0, "only trigger harakiri if queue is greater than this threshold", uwsgi_opt_set_int, &uwsgi.harakiri_queue_threshold, 0},
{"harakiri-no-arh", no_argument, 0, "do not enable harakiri during after-request-hook", uwsgi_opt_true, &uwsgi.harakiri_no_arh, 0},
{"no-harakiri-arh", no_argument, 0, "do not enable harakiri during after-request-hook", uwsgi_opt_true, &uwsgi.harakiri_no_arh, 0},
Expand Down
1 change: 1 addition & 0 deletions uwsgi.h
Original file line number Diff line number Diff line change
Expand Up @@ -2488,6 +2488,7 @@ struct uwsgi_server {
int harakiri_verbose;
int harakiri_graceful_timeout;
int harakiri_graceful_signal;
int harakiri_only_graceful;
int harakiri_queue_threshold;
int harakiri_no_arh;

Expand Down
Loading