Adjust RLIMITs after freezing Configuration namespace

Adjust resource limits only after freezing the `Configuration` to
account for any user-provided overrides via the `-D/--define` command
line option. Previously, resource limits were adjusted before processing
command line options, and any user-provided overrides were accepted but
not applied. Now, a command like this one works as intended and used 32
as the stack limit instead of the 64 provided as env var:

$ ICINGA2_RLIMIT_STACK=64 icinga2 daemon -DConfiguration.RLimitStack=32
This commit is contained in:
Yonas Habteab 2026-02-23 15:17:33 +01:00
parent d49b10bde6
commit 4d30b03c0f

View file

@ -281,9 +281,6 @@ static int Main()
#endif /* RLIMIT_STACK */
}
if (!autocomplete)
Application::SetResourceLimits();
LogSeverity logLevel = Logger::GetConsoleLogSeverity();
Logger::SetConsoleLogSeverity(LogWarning);
@ -442,6 +439,10 @@ static int Main()
Configuration::Concurrency = std::thread::hardware_concurrency();
}
if (!autocomplete) {
Application::SetResourceLimits();
}
Application::GetTP().Restart();
/* Ensure that all defined constants work in the way we expect them. */