[🐛 Bug]: terminationGracePeriodSeconds is hardcoded to 30 for scalingType job, ignoring both configured values
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- helm, kubernetes
- Lĩnh vực
- devops, infrastructure
Hướng nghiên cứu
Bắt đầu trong templates/_helpers.tpl tại seleniumGrid.node.terminationGracePeriodSeconds, sau đó đọc phần README của chart mô tả việc ghi đè theo từng node. Chạy ba lệnh helm template và yq từ issue để tái hiện đầu ra của job và deployment. Hoàn tất nghĩa là hành vi được chấp nhận đã được triển khai hoặc giới hạn của job-mode đã được ghi rõ trong tài liệu, với kết quả được render khớp với quyết định đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Go
- Star
- 8.7k
- Fork
- 2.5k
- Merge trung bình
- 1 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 37
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SeleniumHQ/docker-selenium
-
Nightly build is failingĐang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 25/100
SeleniumHQ/docker-selenium#3338 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[🐛 Bug]: hub & node-chromium - cURL 8.22.0 & guava 33.6.0-android pulled in, needs security fixesĐang mởneeds-triaging
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 54/100
SeleniumHQ/docker-selenium#3332 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triaging
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
SeleniumHQ/docker-selenium#3299 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triaging
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
SeleniumHQ/docker-selenium#3298 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triaging
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
SeleniumHQ/docker-selenium#3279 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SeleniumHQ/docker-selenium
Issue tương tự
-
bug effort:s impact:med raised-by:desk risk:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
medici-finance/assay#8342 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug sweep
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
bketelsen/truenas-mcp#120 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nwverse/persona#22164 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
sresarehumantoo/cc-artex#559 ·