Skip to content

Commit

Permalink
mxqd: Remove RLIMIT_CPU usage for runtime limitation
Browse files Browse the repository at this point in the history
The current code applies a RLIMIT_CPU limit to jobs with `job_threads == i`.
This is incorrect, as such jobs can still get more processors if they
require more server slots because of their memory demands.

Since mxqd can now monitor and reliably kill jobs that exceed their
allowed runtime, this code is obsolete and no longer useful.

There is no reason to fix this code, so remove it entirely.
  • Loading branch information
donald committed Sep 11, 2024
1 parent adb6f2f commit 92167df
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions mxqd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,17 +1018,6 @@ static void exec_reaper(struct mxq_server *server,struct mxq_group_list *glist,
mx_log_err("job=%s(%d):%lu:%lu setrlimit(RLIMIT_CORE, ...) failed: %m",
group->user_name, group->user_uid, group->group_id, job->job_id);

/* set single threaded time limits */
if (group->job_threads == 1) {
/* set cpu time limits - hardlimit is 105% of softlimit */
rlim.rlim_cur = group->job_time*60;
rlim.rlim_cur = group->job_time*63;

if (setrlimit(RLIMIT_CPU, &rlim) == -1)
mx_log_err("job=%s(%d):%lu:%lu setrlimit(RLIMIT_CPU, ...) failed: %m",
group->user_name, group->user_uid, group->group_id, job->job_id);
}

if (initgroups(passwd->pw_name, group->user_gid) == -1) {
mx_log_err("job=%s(%d):%lu:%lu initgroups() failed: %m",
group->user_name, group->user_uid, group->group_id, job->job_id);
Expand Down

0 comments on commit 92167df

Please sign in to comment.