kedacore / keda

KEDA is a Kubernetes-based Event Driven Autoscaling component. It provides event driven scale for any container running in Kubernetes
https://keda.sh
Apache License 2.0
8.27k stars 1.05k forks source link

panic while refreshing a scaler cache #5926

Open vflaux opened 2 months ago

vflaux commented 2 months ago

Report

Encountered one panic:

panic: runtime error: index out of range [1] with length 0

goroutine 1738630 [running]:
github.com/kedacore/keda/v2/pkg/scaling/cache.(*ScalersCache).refreshScaler(0xc07feb2fc0, {0x49cf798?, 0xc0431fa930?}, 0x1)
    /workspace/pkg/scaling/cache/scalers_cache.go:159 +0x44b
github.com/kedacore/keda/v2/pkg/scaling/cache.(*ScalersCache).GetMetricsAndActivityForScaler(0xc07feb2fc0, {0x49cf798, 0xc0431fa930}, 0x1, {0xc003ac5fb0, 0x2d})
    /workspace/pkg/scaling/cache/scalers_cache.go:135 +0x1b2
github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).GetScaledObjectMetrics.func1(_, _, {_, _}, _, {{0xc03c2f6720, 0x27}, {0xc03c936340, 0x4}, {0x3648ab8, ...}, ...}, ...)
    /workspace/pkg/scaling/scale_handler.go:527 +0x4f4
created by github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).GetScaledObjectMetrics in goroutine 1738628
    /workspace/pkg/scaling/scale_handler.go:503 +0x1d6d

Expected Behavior

No panic

Actual Behavior

Random panic

Steps to Reproduce the Problem

I can't figure out how to reproduce the panic.

Logs from KEDA operator

No response

KEDA Version

2.14.0

Kubernetes Version

1.28

Platform

Amazon Web Services

Scaler Details

No response

Anything else?

SpiritZhou commented 1 month ago

What scaler are you using? Could you provide more detail info such as the scaleobject yaml?