Runner cancels a healthy running job after 10 cumulative (not consecutive) retriable broker poll errors
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Bắt đầu trong src/Runner.Listener/BrokerMessageListener.cs, tại GetNextMessageAsync, và theo dõi continuousError cùng encounteringError thay đổi thế nào khi một lần thăm dò thành công hoặc ném ngoại lệ. Issue xác định đường đi thăm dò không có thông báo là một lần thăm dò thành công cần đặt lại các bộ đếm. Hãy xác nhận hành vi bằng các bài kiểm thử hiện có liên quan, nếu có, và kiểm tra rằng chỉ các lần thăm dò thất bại liên tiếp mới đạt đến giới hạn thử lại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version / environment: runner v2.338.0 (the same code is on main; I did not read the v2.338.1 tag itself), Linux ARM64, self-hosted, systemd service.
What happens
While a job is running, the listener keeps polling the broker (GET .../message?...&status=Busy). On our network some of these long-polls hit the client's 100 s HTTP timeout. Each one that escapes the inner request retry is logged as Retriable exception: The HTTP request timed out after 00:01:40. and the listener backs off and polls again, as intended.
But after the 10th such exception during the same job, the listener shuts down its job dispatcher and sends a cancellation to the worker, even though the job itself is healthy (job renewals were still succeeding). The job ends as cancelled. On our machine a retriable exception escapes about every 9.5 minutes, so every job that runs longer than about 95 minutes is cancelled at that point. Three jobs in one day were cancelled at 95.4, 95.6 and 96.1 minutes; a job that finished at 93.75 minutes passed.
Log sequence at the cancellation (session ids removed):
[... INFO BrokerMessageListener] Retriable exception: The HTTP request timed out after 00:01:40.
[... INFO JobDispatcher] Shutting down JobDispatcher. Make sure all WorkerDispatcher has finished.
[... INFO JobDispatcher] Ensure WorkerDispatcher for job ... run to finish, cancel any running job.
[... INFO JobDispatcher] Send job cancellation message to worker for job ...
[... INFO JobDispatcher] finish job request for job ... with result: Canceled
In both logs I checked, this was exactly the 10th Retriable exception after the job started.
Cause in the source
src/Runner.Listener/BrokerMessageListener.cs, GetNextMessageAsync (v2.338.0, lines 281-371; the same lines on main):
- line 281:
int continuousError = 0; - line 284:
var maxRetryCount = 10; - line 361:
continuousError++;on every retriable exception - lines 369-371:
else if (continuousError >= maxRetryCount) { throw; }
continuousError is never set back to 0. A poll that returns no message just does continue (lines ~306-309), and nothing else resets it. The call to GetNextMessageAsync stays open for the whole time a job runs, so the counter accumulates every poll failure over the job's lifetime, not consecutive ones as the name and the "random backoff ... consecutive error" comments suggest. Any sufficiently long job on a network with occasional dropped long-polls will eventually reach 10.
Expected behaviour
Only 10 consecutive failed polls should give up. A successful poll (including one that returns no message) should reset the counter.
Possible fix
Reset continuousError (and encounteringError) to 0 after a poll completes without throwing, i.e. just before the if (message == null) { continue; } check. I have not built or tested a patched runner. It may also be worth making maxRetryCount configurable.
Workaround
Keep jobs shorter than the point where the 10th escaped timeout happens (about 95 minutes for us).
Not established
Why the broker long-polls time out at 100 s on our network. They also happen on idle runners, and a renewjob POST sometimes fails with "The response ended prematurely". That may be our network; this issue is only about the listener treating cumulative errors as consecutive.
- Ngôn ngữ chính
- C#
- Star
- 6.4k
- Fork
- 1.5k
- Merge trung bình
- 1 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 36
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không 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 actions/runner
-
Workflow schema omits documented code-quality and copilot-requests permissionsCó thể đã có người làm @localzet đã nhận 12 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/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
actions/runner#4692 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Runner crashes at InitializeSecretMasker on machines with Thai (th-TH) culture — culture-sensitive LastIndexOf in PowerShellPreAmpersandEscapeCó thể đã có người làm @CloudNinjaDev đã nhận 48 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Broker retry logs an ERR stack trace and a phantom backoff on every job completion (listener's own cancellation treated as a request failure)Có thể đã có người làm @nitrobass24 đã nhận 87 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
actions/runner#4600 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của actions/runner
Issue tương tự
-
bug module
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Tichau/FileConverter#829 ·
Maintainer thường phản hồi trong vòng 9 ngày
-
needs triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 71/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
majorsilence/Majorsilence.Forms#718 ·
Maintainer thường phản hồi trong vòng 1 ngày