Skip to content

Commit

Permalink
mxqd: killall_over_memory: Send SIGKILL after sending SIGTERM
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux committed Oct 30, 2015
1 parent 66c151f commit 925a2ee
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions mxqd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1660,9 +1660,16 @@ int killall_over_memory(struct mxq_server *server)

for (jlist = glist->jobs; jlist; jlist = jlist->next) {
unsigned long long int memory;
int signal;

job = &jlist->job;

/* sigterm has already been send last round ? */
if (jlist->max_sum_rss/1024 > group->job_memory)
signal = SIGKILL;
else
signal = SIGTERM;

pinfo = mx_proc_tree_proc_info(ptree, job->host_pid);
if (!pinfo) {
mx_log_warning("killall_over_memory(): Can't find process with pid %llu in process tree",
Expand All @@ -1678,16 +1685,17 @@ int killall_over_memory(struct mxq_server *server)
if (jlist->max_sum_rss/1024 <= group->job_memory)
continue;

mx_log_info("killall_over_memory(): used(%lluMiB) > requested(%lluMiB): Sending signal=TERM to job=%s(%d):%lu:%lu pid=%d",
mx_log_info("killall_over_memory(): used(%lluMiB) > requested(%lluMiB): Sending signal=%d to job=%s(%d):%lu:%lu pid=%d",
jlist->max_sum_rss/1024,
group->job_memory,
signal,
group->user_name,
group->user_uid,
group->group_id,
job->job_id,
job->host_pid);

kill(job->host_pid, SIGTERM);
kill(job->host_pid, signal);
}
}
}
Expand Down

0 comments on commit 925a2ee

Please sign in to comment.