Skip to content

Commit 6abd2fb

Browse files
fix(maxprocs): treat ConfigureMaxProcs error as non-fatal (#7655)
When KEDA runs in environments where /sys/fs/cgroup/cpu.max is not readable (e.g. EKS auto-mode, restricted SecurityContexts), maxprocs.Set() returns a permission error and KEDA crashes on startup. The Go runtime handles GOMAXPROCS sensibly without explicit configuration, so this error should not be fatal. Log it as a warning and continue startup. Fixes #7653 Signed-off-by: ManvithaP-hub <62259625+ManvithaP-hub@users.noreply.github.com>
1 parent 2efa0dd commit 6abd2fb

3 files changed

Lines changed: 6 additions & 13 deletions

File tree

cmd/adapter/main.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,8 @@ func main() {
288288
return
289289
}
290290

291-
err = kedautil.ConfigureMaxProcs(setupLog)
292-
if err != nil {
293-
setupLog.Error(err, "failed to set max procs")
294-
return
291+
if err := kedautil.ConfigureMaxProcs(setupLog); err != nil {
292+
setupLog.Info("failed to set max procs, using default GOMAXPROCS", "error", err)
295293
}
296294

297295
kedaProvider, err := cmd.makeProvider(ctx)

cmd/operator/main.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,8 @@ func main() {
124124
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
125125
ctx := ctrl.SetupSignalHandler()
126126

127-
err := kedautil.ConfigureMaxProcs(setupLog)
128-
if err != nil {
129-
setupLog.Error(err, "failed to set max procs")
130-
os.Exit(1)
127+
if err := kedautil.ConfigureMaxProcs(setupLog); err != nil {
128+
setupLog.Info("failed to set max procs, using default GOMAXPROCS", "error", err)
131129
}
132130

133131
namespaces, err := kedautil.GetWatchNamespaces()

cmd/webhooks/main.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,9 @@ func main() {
7878

7979
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
8080

81-
err := kedautil.ConfigureMaxProcs(setupLog)
82-
if err != nil {
83-
setupLog.Error(err, "failed to set max procs")
84-
os.Exit(1)
81+
if err := kedautil.ConfigureMaxProcs(setupLog); err != nil {
82+
setupLog.Info("failed to set max procs, using default GOMAXPROCS", "error", err)
8583
}
86-
8784
ctx := ctrl.SetupSignalHandler()
8885

8986
cfg := ctrl.GetConfigOrDie()

0 commit comments

Comments
 (0)