Race condition when closing LDS
Chưa có ai nhận issue này.
- #756 của @ab-pm — đã đóng, không merge
Đá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
- 32/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- backend, testing-qa
Hướng nghiên cứu
Bắt đầu trong packages/lds/src/index.ts, tại vòng lặp quanh lệnh gọi getChanges, và xem xét teardown của integration test gọi schema.__pgLdsSource?.close(). Chạy integration test suite dưới tải hoặc với sleepDuration tối thiểu. Được coi là hoàn tất khi việc đóng source dừng reliably polling trong tương lai và suite thoát mà không lặp lại các lỗi “Pool has been closed”.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
In our integration test suite, we do teardown the LDS Live Source by calling schema.__pgLdsSource?.close(). This does however not work consistently, and from time to time (apparently when the server - that also runs the db in a docker container - is under higher load) it fails to stop the LDS loop and the test job (github action) is only stopped by timing out, failing the build step.
In the meantime, it does keep logging
Error during LDS loop: Pool has been closed
I believe I tracked this down to a bug in https://github.com/graphile/graphile-engine/blob/6692c2a65f406c55c3d1edfff51c8f7cc2296956/packages/lds/src/index.ts#L96-L101
async function loop() {
try {
const rows = await client.getChanges(null, 500);
…
} catch (e) {
console.error("Error during LDS loop:", e.message);
// Recovery time...
loopTimeout = setTimeout(loop, sleepDuration * 10);
return;
}
loopTimeout = setTimeout(loop, sleepDuration);
}
loop();
While the client.getChanges query is awaited, no timeout is scheduled and the clearTimeout will be ineffective, so the loop will start over even after .close() has been called.
Steps to reproduce
By setting the sleepDuration to a minimum value, the loop spends much more time in the query so a close() will hit the sleep much less likely.
Possible Solution
I can see a few approaches:
- just set a
closedflag and check this before callingsetTimeoutagain .unref()each timer? I think this might have worked in my case, but probably not a generic solution- check whether the
client.poolis closed before callinggetChanges(), and breaking out of the loop - check whether the
client.poolis closed in thecatchhandler of the loop, breaking out from there - a specific "client closed" exception that is handled differently in the
catchof the loop, breaking out from there
- Ngôn ngữ chính
- JavaScript
- Star
- 764
- Fork
- 128
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không 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 graphile/graphile-engine
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
graphile/graphile-engine#869 · 1 bình luận · 1 reaction ·
-
Provide a type guard to distinguish between ResolveTree and FieldsByTypeNameCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
graphile/graphile-engine#849 · 2 bình luận · 1 reaction ·
-
🐛 bug help wanted
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
graphile/graphile-engine#818 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
graphile/graphile-engine#725 · 17 bình luận · 5 reaction ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
graphile/graphile-engine#723 ·
Tất cả issue của graphile/graphile-engine
Issue tương tự
-
Độ 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 72/100
directus/directus#28558 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
cloudflare/workers-sdk#17189 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
AWS Lambda Waiting for: Product Owner
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
getsentry/sentry-javascript#26910 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[🐛 Bug]: @wdio/reporter drops the function name of a string script in command outputCó thể đã có người làm @dhananjay6561 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
webdriverio/webdriverio#16507 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày