]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: threads: Fix binding thread on bind.
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 13 Jan 2026 10:42:32 +0000 (11:42 +0100)
committerOlivier Houchard <ohouchard@haproxy.com>
Tue, 13 Jan 2026 10:45:46 +0000 (11:45 +0100)
The code to parse the "thread" keyword on bind lines was changed to
check if the thread numbers were correct against the value provided with
max-threads-per-group, if any were provided, however, at the time those
thread keywords have been set, it may not yet have been set, and that
breaks the feature, so revert to check against MAX_THREADS_PER_GROUP instead,
it should have no major impact.

src/thread.c

index 80b84018ae3f4965537be0a49ea2958559f49024..279e4f0e48a532881ac8e7b47fd0e77ee2bd6f40 100644 (file)
@@ -1874,7 +1874,7 @@ int parse_thread_set(const char *arg, struct thread_set *ts, char **err)
                if (!*set) {
                        /* empty set sets no restriction */
                        min = 1;
-                       max = is_rel ? global.maxthrpertgroup : MAX_THREADS;
+                       max = is_rel ? MAX_THREADS_PER_GROUP : MAX_THREADS;
                }
                else {
                        if (sep != set && *sep && *sep != '-' && *sep != ',') {
@@ -1902,9 +1902,9 @@ int parse_thread_set(const char *arg, struct thread_set *ts, char **err)
                                        max = min = 0; // throw an error below
                        }
 
-                       if (min < 1 || min > MAX_THREADS || (is_rel && min > global.maxthrpertgroup)) {
+                       if (min < 1 || min > MAX_THREADS || (is_rel && min > MAX_THREADS_PER_GROUP)) {
                                memprintf(err, "invalid first thread number '%s', permitted range is 1..%d, or 'all', 'odd', 'even'.",
-                                         set, is_rel ? global.maxthrpertgroup : MAX_THREADS);
+                                         set, is_rel ? MAX_THREADS_PER_GROUP : MAX_THREADS);
                                return -1;
                        }
 
@@ -1921,15 +1921,15 @@ int parse_thread_set(const char *arg, struct thread_set *ts, char **err)
                                v = atoi(set);
 
                                if (sep == set) { // no digit: to the max
-                                       max = is_rel ? global.maxthrpertgroup : MAX_THREADS;
+                                       max = is_rel ? MAX_THREADS_PER_GROUP : MAX_THREADS;
                                        if (*sep && *sep != ',')
                                                max = 0; // throw an error below
                                } else
                                        max = v;
 
-                               if (max < 1 || max > MAX_THREADS || (is_rel && max > global.maxthrpertgroup)) {
+                               if (max < 1 || max > MAX_THREADS || (is_rel && max > MAX_THREADS_PER_GROUP)) {
                                        memprintf(err, "invalid last thread number '%s', permitted range is 1..%d.",
-                                                 set, is_rel ? global.maxthrpertgroup : MAX_THREADS);
+                                                 set, is_rel ? MAX_THREADS_PER_GROUP : MAX_THREADS);
                                        return -1;
                                }
                        }