Task identifier cache keeps a rejected lookup forever, wedging the runner after a connection drop
@agustin18 đang làm issue này rồi.
Từ ngày 23/11/2026.
Đá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
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- node.js, postgresql, typescript
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu trong src/taskIdentifiers.ts: cache.lastStr và cache.lastDigest được đặt trước lookup bất đồng bộ và không bao giờ bị xóa khi nó bị reject, vì vậy getJobs chờ cùng một reject ở mỗi poll. Đọc logic cache đó cùng với lệnh gọi withPgClient.withRetries (chỉ retry 40001/40P01/57P03/EHOSTUNREACH/ETIMEDOUT) và log getJob ở mức debug trong worker.js. Tái hiện bằng cách kết thúc backend của lookup bằng pg_terminate_backend và thêm một job; done nghĩa là runner phục hồi ở poll tiếp theo, lý tưởng nhất là với các lỗi lặp lại được ghi log trên mức debug.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version: graphile-worker 0.18.0 (the same code is on main)
What happens
If the task-identifier lookup fails once (for example the Postgres backend is terminated with pg_terminate_backend, a failover, "Connection terminated unexpectedly", or a pool checkout timeout during the first poll after start), the runner never recovers. It keeps polling every pollInterval, each poll fails with the same error logged only at debug level, and jobs added afterwards never run. The runner promise never settles, so a supervisor has nothing to restart.
Cause
src/taskIdentifiers.ts sets cache.lastStr before the async lookup and stores the lookup's promise in cache.lastDigest. Nothing clears them when that promise rejects, so every later call returns the same rejected promise. The lookup runs through withPgClient.withRetries, which retries only 40001, 40P01, 57P03, EHOSTUNREACH and ETIMEDOUT; a 57P01 (admin shutdown) or a dropped connection fails once and is then cached. getJobs awaits that cached rejection on every poll, and worker.js logs it at debug.
Reproduce
- Start a worker pool with a few task identifiers.
- Terminate the backend running the lookup's
insert into graphile_worker._private_tasks(select pg_terminate_backend(pid) ...) while it runs. - Add a job. It stays
locked_by = null, attempts = 0and due; the log shows only debug-level getJob errors (about 170 in 10 s).
Adding 0–40 ms of random delay to pool checkout makes this happen in roughly 1 in 4 starts under a terminated connection.
Suggested fix
Clear the cache when the lookup rejects, so the next poll retries it:
cache.lastDigest.catch(() => {
if (cache.lastStr === str) cache.lastStr = '';
});
We run this as a local patch and the runner recovers on the next poll. It may also be worth logging repeated getJob failures above debug level.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.5k
- Fork
- 134
- Merge trung bình
- 16 giờ 24 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Có Dockerfile hoặc 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 graphile/worker
-
Memory leak: `taskIdentifiers` cache keeps every `run()`'s options for the life of the processĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Batched `completeJobs`/`failJobs` are never retried: the retry loop in `batch()` exits after the first failureCó thể đã có người làm @ujjawal-yadav đã nhận 42 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
-
`runner.promise` resolves when the worker pool exits with an errorCó thể đã có người làm @Krrishkumar125 đã nhận 35 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
-
Write docs for local queue!Có thể đã có người làm @Krrishkumar125 đã nhận 34 ngày trước. Đang mởdocs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Unhandled rejection when recording a job's outcome fails with unbatched completeJob/failJobCó thể đã có người làm @cpruijsen đã nhận 44 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
Tất cả issue của graphile/worker
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
abhigyanpatwari/GitNexus#4124 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
laaielichter/Godotwright#250 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
An Antigravity tab can quote an old Assist message as the owner's words in a resumed conversationĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Retry an empty final answer when Gemini reports MALFORMED_RESPONSE (gemini-4-hydrogen)Có thể đã có người làm @waleedkadous đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
iaser-ai/ansari#444 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Manager UI logo fails to load — broken external URLCó thể đã có người làm @kavindu-udara đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100