From e2696a6202e47557c1142dd012b02fce06e35f9f Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 13 Aug 2020 10:25:09 +0200 Subject: [PATCH 1/3] mxqd: Fix checks for group_jobs and jobs_max After commit e6ef2ad4d965c56d1c0d566de5b0667d3c9e4fa6 ("Move server_is_qualified() to mxqd_control") the result of the qualification checks (blacklist, whitelist, prerequisites, exclusive mode) are no longer stored as a boolean in glist->server_is_qualified. Instead, glist->jobs_max is set to 0 if the server is not qualified to start a job from the group. However, there is a bug in start_user: if (glist->jobs_running == group->group_jobs) { continue; } if (glist->jobs_running == glist->jobs_max) { continue; } The number of jobs running may actually be higher then the current limits, if limits are decreased while jobs are already running. This not only applies to changes cause by mxqset, but also to a server restart with different limits. Change comparisons from equality to greater than or equal. --- mxqd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mxqd.c b/mxqd.c index 7274b9e1..efa864d9 100644 --- a/mxqd.c +++ b/mxqd.c @@ -1428,10 +1428,10 @@ unsigned long start_user(struct mxq_user_list *ulist, long slots_to_start) group = &glist->group; - if (glist->jobs_running == group->group_jobs) { + if (glist->jobs_running >= group->group_jobs) { continue; } - if (glist->jobs_running == glist->jobs_max) { + if (glist->jobs_running >= glist->jobs_max) { continue; } if (mxq_group_jobs_inq(group) == 0) { From 32d4ed785160460eab67ac173ce91a89cbb56be0 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 13 Aug 2020 10:30:59 +0200 Subject: [PATCH 2/3] Remove unused variables from glist remove glist->server_is_qualified and glist->server_is_qualified_evaluated which are no longer used by the current code. --- mxqd.h | 3 --- mxqd_control.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/mxqd.h b/mxqd.h index f21d5fd2..bec7fabc 100644 --- a/mxqd.h +++ b/mxqd.h @@ -44,9 +44,6 @@ struct mxq_group_list { unsigned long global_threads_running; unsigned long global_slots_running; - int server_is_qualified_evaluated; - int server_is_qualified; - short orphaned; }; diff --git a/mxqd_control.c b/mxqd_control.c index 44b4b49d..e6319549 100644 --- a/mxqd_control.c +++ b/mxqd_control.c @@ -137,9 +137,6 @@ static void _group_list_init(struct mxq_group_list *glist) glist->slots_max = slots_max; glist->memory_max = memory_max; - glist->server_is_qualified_evaluated = 0; - glist->server_is_qualified = 0; - glist->orphaned = 0; } From ef4fcef0e98b640aab0103c8d5a29e5ea1835ae3 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 13 Aug 2020 10:35:18 +0200 Subject: [PATCH 3/3] MXQ bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 25a904ca..ab15be67 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ MXQ_VERSION_MAJOR = 0 MXQ_VERSION_MINOR = 26 -MXQ_VERSION_PATCH = 5 +MXQ_VERSION_PATCH = 6 MXQ_VERSION_EXTRA = "beta" MXQ_VERSIONDATE = 2016