From 6152a4eef51418bc1ed0b90f0ce652440c876917 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 18 Mar 2026 10:39:30 +0100 Subject: [PATCH] MINOR: config: support explicit "on" and "off" for "set-dumpable" The global "set-dumpable" keyword currently is only positional. Let's extend its syntax to support arguments. For now we support both "on" and "off" to explicitly enable or disable it. --- doc/configuration.txt | 7 ++++--- src/cfgparse-global.c | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index a1cfd032c..fd60f4205 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -3148,10 +3148,11 @@ server-state-file configuration. See also "server-state-base" and "show servers state", "load-server-state-from-file" and "server-state-file-name" -set-dumpable +set-dumpable [ on | off ] This option is better left disabled by default and enabled only upon a - developer's request. If it has been enabled, it may still be forcibly - disabled by prefixing it with the "no" keyword. It has no impact on + developer's request. By default it is disabled. Without argument, it defaults + to "on". If it has been enabled, it may still be forcibly disabled by prefixing + it with the "no" keyword or by setting it to "off". It has no impact on performance nor stability but will try hard to re-enable core dumps that were possibly disabled by file size limitations (ulimit -f), core size limitations (ulimit -c), or "dumpability" of a process after changing its UID/GID (such diff --git a/src/cfgparse-global.c b/src/cfgparse-global.c index 81616c218..f1c4b7a17 100644 --- a/src/cfgparse-global.c +++ b/src/cfgparse-global.c @@ -89,12 +89,21 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) global.tune.options |= GTUNE_BUSY_POLLING; } else if (strcmp(args[0], "set-dumpable") == 0) { /* "no set-dumpable" or "set-dumpable" */ - if (alertif_too_many_args(0, file, linenum, args, &err_code)) + if (alertif_too_many_args(1, file, linenum, args, &err_code)) goto out; - if (kwm == KWM_NO) + if (kwm == KWM_NO) { global.tune.options &= ~GTUNE_SET_DUMPABLE; - else - global.tune.options |= GTUNE_SET_DUMPABLE; + goto out; + } + if (!*args[1] || strcmp(args[1], "on") == 0) + global.tune.options |= GTUNE_SET_DUMPABLE; + else if (strcmp(args[1], "off") == 0) + global.tune.options &= ~GTUNE_SET_DUMPABLE; + else { + ha_alert("parsing [%s:%d] : '%s' only supports 'on' and 'off' as an argument, found '%s'.\n", file, linenum, args[0], args[1]); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } } else if (strcmp(args[0], "h2-workaround-bogus-websocket-clients") == 0) { /* "no h2-workaround-bogus-websocket-clients" or "h2-workaround-bogus-websocket-clients" */ if (alertif_too_many_args(0, file, linenum, args, &err_code))