[🐛 Bug]: terminationGracePeriodSeconds is hardcoded to 30 for scalingType job, ignoring both configured values
维护者通常 1 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 65/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- helm, kubernetes
- 领域
- devops, infrastructure
调研方向
从 templates/_helpers.tpl 中的 seleniumGrid.node.terminationGracePeriodSeconds 开始,然后阅读 chart README 中描述按节点覆盖的部分。运行 issue 中的三个 helm template 和 yq 命令,以复现 job 和 deployment 的输出。完成的标准是:已实现接受的行为,或已明确记录 job-mode 的限制,并且渲染结果与该决定一致。
由索引模型根据 Issue 内容生成。
描述
What happened?
With autoscaling.scalingType: job, a browser node pod always renders terminationGracePeriodSeconds: 30. Both configurable values are ignored.
seleniumGrid.node.terminationGracePeriodSeconds in templates/_helpers.tpl reads autoscaling.terminationGracePeriodSeconds and the per-node <node>.terminationGracePeriodSeconds, then discards both and returns a literal 30 when KEDA is enabled and scalingType is job:
{{- $autoscalingPeriod := default 0 .Values.autoscaling.terminationGracePeriodSeconds | int -}}
{{- $nodePeriod := default 0 .node.terminationGracePeriodSeconds | int -}}
{{- $period := $nodePeriod -}}
{{- if and (eq .Values.autoscaling.scalingType "deployment") (eq (include "seleniumGrid.useKEDA" $) "true") -}}
{{- $period = ternary $nodePeriod $autoscalingPeriod (gt $nodePeriod $autoscalingPeriod) -}}
{{- else if and (eq .Values.autoscaling.scalingType "job") (eq (include "seleniumGrid.useKEDA" $) "true") }}
{{- $period = 30 -}}
{{- end -}}
The chart README documents the per-node override with a worked chromeNode: terminationGracePeriodSeconds: 7200 example. That example sits under a heading scoped to deployment, but the README never states what job mode uses, and nothing warns that the override is inert there. So on a job-scaled grid the documented setting renders no change and gives no signal that it was ignored.
Why this matters in practice: in job mode the preStop hook drains the node and waits for the running session to finish. That is fine while pods complete on their own, which is the normal job lifecycle. But when a pod is deleted mid-session — a chart upgrade rolling the control plane, a node drain, or cluster-autoscaler consolidation — the hook is killed once the window expires and the session dies. With the window fixed at 30s there is no supported way to widen it, so any session longer than that is unprotected against pod deletion.
Two possible resolutions, and I would rather ask than assume:
- Honour the configured value in
jobmode (falling back to30when neither is set). This is the one that would actually help, since it makes the window tunable to real session lengths. - If the fixed window is deliberate for job scaling, then documenting it — stating what
jobmode uses and that the override does not apply there — would at least remove the trap.
Happy to open a PR for either once you say which you would accept.
Command used to start Selenium Grid with Docker (or Kubernetes)
# 1. job mode + per-node override -> renders 30
helm template t ./charts/selenium-grid \
--set autoscaling.enabled=true --set autoscaling.scalingType=job \
--set chromeNode.terminationGracePeriodSeconds=7200 \
| yq 'select(.kind=="ScaledJob" and (.metadata.name|test("chrome"))) | .spec.jobTargetRef.template.spec.terminationGracePeriodSeconds'
# 2. job mode + autoscaling-level value -> renders 30
helm template t ./charts/selenium-grid \
--set autoscaling.enabled=true --set autoscaling.scalingType=job \
--set autoscaling.terminationGracePeriodSeconds=7200 \
| yq 'select(.kind=="ScaledJob" and (.metadata.name|test("chrome"))) | .spec.jobTargetRef.template.spec.terminationGracePeriodSeconds'
# 3. deployment mode + per-node override -> renders 7200 (works as documented)
helm template t ./charts/selenium-grid \
--set autoscaling.enabled=true --set autoscaling.scalingType=deployment \
--set chromeNode.terminationGracePeriodSeconds=7200 \
| yq 'select(.kind=="Deployment" and (.metadata.name|test("chrome"))) | .spec.template.spec.terminationGracePeriodSeconds'
Relevant log output
# rendered terminationGracePeriodSeconds from the three commands above
1. job mode, chromeNode.terminationGracePeriodSeconds=7200 -> 30
2. job mode, autoscaling.terminationGracePeriodSeconds=7200 -> 30
3. deployment mode, chromeNode.terminationGracePeriodSeconds=7200 -> 7200
# what it looks like when a pod is deleted while a session is still running:
# the hook is still waiting for the slot to clear when the window expires
Warning FailedPreStopHook pod/<release>-selenium-node-chrome-xxxxx-yyyyy PreStopHook failed
Operating System
Linux (GKE)
Docker Selenium version (image tag)
4.47.0-20260808
Selenium Grid chart version (chart version)
0.58.0
- 主要语言
- Go
- 星标
- 8.7k
- 派生
- 2.5k
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 37
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
SeleniumHQ/docker-selenium 的其他 Issue
-
难度 4/5 1-2 天 新手友好度 25/100
SeleniumHQ/docker-selenium#3338 ·
维护者通常 1 天内回复
-
[🐛 Bug]: hub & node-chromium - cURL 8.22.0 & guava 33.6.0-android pulled in, needs security fixes未关闭needs-triaging
难度 3/5 1-2 天 新手友好度 54/100
SeleniumHQ/docker-selenium#3332 · 1 条评论 ·
维护者通常 1 天内回复
-
needs-triaging
难度 4/5 3-5 天 新手友好度 35/100
SeleniumHQ/docker-selenium#3299 · 2 条评论 ·
维护者通常 1 天内回复
-
needs-triaging
难度 4/5 3-5 天 新手友好度 48/100
SeleniumHQ/docker-selenium#3298 · 2 条评论 ·
维护者通常 1 天内回复
-
needs-triaging
难度 4/5 3-5 天 新手友好度 48/100
SeleniumHQ/docker-selenium#3279 · 2 条评论 ·
维护者通常 1 天内回复
查看 SeleniumHQ/docker-selenium 的全部 Issue
相似的 Issue
-
bug effort:s impact:med raised-by:desk risk:low
难度 2/5 1-3 小时 新手友好度 75/100
medici-finance/assay#8342 · 1 条评论 ·
维护者通常 1 天内回复
-
bug sweep
难度 2/5 1-3 小时 新手友好度 76/100
bketelsen/truenas-mcp#120 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
nwverse/persona#22164 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 90/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
sresarehumantoo/cc-artex#559 ·