[🐛 Bug]: ScaledJob default scalingStrategy "accurate" (since chart 0.56.0) causes runaway node job creation; "default" no longer selectable on KEDA 2.20+

未关闭
#3,167 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
56/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
helm, kubernetes, yaml

调研方向

该 issue 指向 Selenium Grid 的 chart values 中的 autoscaling.scaledJobOptions.scalingStrategy,以及 README 或 values 注释;从这里开始,并将当前默认值与 KEDA 2.20 支持的策略进行比较。完成的标准是 chart 能够避免报告的失控行为,替代设置得到记录,并且现有受支持的 KEDA 版本仍然得到覆盖。

由索引模型根据 Issue 内容生成。

描述

What happened?

Chart 0.56.0 (commit 9cc943b1, #3149 — "KEDA 2.20.1+ unsupported job scale strategy 'default'") changed the default autoscaling.scaledJobOptions.scalingStrategy.strategy from default to accurate.

accurate has a long-known over-provisioning / "node pods stay without active session" problem for scalingType: job (#2133, #2068, #1904, kedacore/keda#4833). The historical guidance in those issues was to set strategy: default. That escape hatch is now gone: KEDA 2.20 removed default from the ScaledJob CRD scalingStrategy.strategy enum (it is now only custom | accurate | eager), so the previous fix can no longer be applied on KEDA ≥ 2.20.

Net effect: upgrading to chart 0.56.0 (which also moves to the KEDA 2.20.1-based image) silently switches every node ScaledJob to accurate and reintroduces the runaway, with no default fallback.

Observed in production (KEDA 2.20.1, chart 0.56.0, scalingType: job): chrome node jobs run away to maxReplicaCount (we hit our cap of 1000 pods) and never scale back to the idle baseline. During multi-hour windows with 0 active grid sessions, ~254 node pods stayed Running. Before the 0.56.0 rollout — same config, strategy: default — node counts reliably returned to a small idle baseline after each burst.

Root cause (KEDA v2.20.1 pkg/scaling/executor/scale_jobs.go)
  • default: effectiveMaxScale = maxScale − runningJobCount
  • accurate: effectiveMaxScale = maxScale − pendingJobCount (ignores running jobs)

pendingJobCount only counts jobs whose pod has not yet reached Running. A Selenium node pod reaches Running well before it registers with the Distributor and claims its queued session (node registration + browser startup). During that window:

  • the session is still in the New Session Queue → maxScale still counts it, but
  • the job is no longer pending (pod is Running) → pendingJobCount does not count it.

So accurate computes maxScale − ~0 and, at a fast pollingInterval, KEDA keeps creating a fresh duplicate job for the same still-queued session on every poll → pile-up to maxReplicaCount. default never did this because it subtracts runningJobCount, which includes those Running-but-not-yet-registered pods.

This is aggravated by large node pods on autoprovisioned nodes (long Pending → Running → registered path) and a small pollingInterval, but the underlying mismatch is that the Selenium scaler's queue metric is not compatible with accurate's "subtract only pending jobs" assumption — which is exactly the "calculation problem" the old # Change this to "accurate" when the calculation problem is fixed values comment referred to.

Suggested fix

Because default is no longer a valid enum value on KEDA ≥ 2.20, default the chart to custom reproducing default's formula:

scaledJobOptions:
  scalingStrategy:
    strategy: custom
    customScalingQueueLengthDeduction: 0
    customScalingRunningJobPercentage: "1"   # maxScale - 0 - runningJobCount*1.0 == maxScale - runningJobCount

custom is accepted by every supported KEDA version and, with these parameters, is byte-for-byte equivalent to the old default behavior. At minimum, the README / values comment should document this as the replacement for the previous strategy: default guidance, since existing users upgrading past KEDA 2.20 will otherwise silently regress.

Relevant log output

KEDA scaleexecutor repeatedly creating jobs while sessions are already being served; node pods remain Running with 0 active sessions.

Environment
  • Chart: selenium-grid 0.56.0 (image 4.45.0-20260606)
  • KEDA: 2.20.1
  • scalingType: job, SE_NODE_MAX_SESSIONS=1, SE_DRAIN_AFTER_SESSION_COUNT=1
  • Kubernetes: GKE 1.3x
Related
  • #2133 — Node pods stay without active session in autoscaling type Job and strategy accurate
  • #2068, #1904 — over-creation / leftover node pods with accurate
  • kedacore/keda#4833
主要语言
Go
星标
8.7k
派生
2.5k
平均合并
1 天 15 小时
30 天内合并 PR
37

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

SeleniumHQ/docker-selenium 的其他 Issue

查看 SeleniumHQ/docker-selenium 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。