FlagsmithClient should support deterministic shutdown of local-evaluation polling
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
Hướng nghiên cứu
Bắt đầu bằng cách đọc FlagsmithClient.cs và PollingManager.cs, tập trung vào finalizer, bộ hẹn giờ polling, callback và phần cleanup StopPoll hiện tại. Triển khai quy trình shutdown xác định và idempotent, trong đó dừng polling, ngăn các request trong tương lai, xử lý các refresh đang chạy khi có thể và duy trì tính an toàn của finalizer; xác minh hành vi dựa trên reproduction được mô tả trong issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
In Flagsmith .NET SDK 9.0.0, enabling local evaluation starts a PollingManager backed by System.Threading.Timer.
The only cleanup currently occurs in the FlagsmithClient finalizer:
~FlagsmithClient() => _pollingManager?.StopPoll();
This does not provide deterministic cleanup when an application host or dependency-injection container stops. Additionally, the timer callback retains the polling manager, whose callback retains the client. This may keep the client reachable and prevent its finalizer from running.
Relevant source:
- https://github.com/Flagsmith/flagsmith-dotnet-client/blob/fc8f50f2004363c951d3c64dcd04d8ffd3cc0c87/Flagsmith.FlagsmithClient/FlagsmithClient.cs
- https://github.com/Flagsmith/flagsmith-dotnet-client/blob/fc8f50f2004363c951d3c64dcd04d8ffd3cc0c87/Flagsmith.FlagsmithClient/PollingManager.cs
Impact
In long-running processes that create and stop application hosts:
- Environment-document requests can continue after the host stops.
- Recreated hosts and tests can accumulate polling timers.
- References to clients, loggers, and related services can remain alive.
- Consumers cannot bind polling cleanup to their application lifecycle.
Process termination masks the issue because the operating system removes the timer.
Reproduction
- Configure
FlagsmithClientwith local evaluation and a short refresh interval. - Point it at an HTTP handler that counts environment-document requests.
- Create the client and observe polling.
- Stop or dispose the owning host or service provider without terminating the process.
- Wait beyond the refresh interval.
- Environment-document requests continue because there is no public shutdown or disposal API.
Expected behaviour
FlagsmithClient should expose deterministic cleanup, for example through IDisposable, IAsyncDisposable, or an explicit shutdown method.
Cleanup should:
- Stop and dispose the polling timer immediately.
- Prevent future environment-document requests.
- Cancel an in-flight refresh where possible.
- Be idempotent.
- Call
GC.SuppressFinalizeif a finalizer remains as a fallback.
This would allow integrations such as OpenFeature providers to stop polling from their normal host shutdown lifecycle.
- Ngôn ngữ chính
- C#
- Star
- 20
- Fork
- 17
- Merge trung bình
- 21 giờ 47 phút
- Pull request đã merge (30 ngày)
- 8
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 Flagsmith/flagsmith-dotnet-client
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Flagsmith/flagsmith-dotnet-client#197 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Dependency DashboardĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Flagsmith/flagsmith-dotnet-client#194 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
Flagsmith/flagsmith-dotnet-client#190 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Local evaluation silently drops identity overrides on large environmentsCó thể đã có người làm @marc-merino đã nhận 38 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Flagsmith/flagsmith-dotnet-client#187 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Flagsmith/flagsmith-dotnet-client#180 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Flagsmith/flagsmith-dotnet-client
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Natvs/Nt.Automaton#33 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
a-corriger documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
christian-raj/S-Aloha#312 ·
-
ready-for-agent tech-debt
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
DigiBanks99/menlo#640 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ci
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
OpenTabletDriver/OpenTabletDriver#5283 ·
Maintainer thường phản hồi trong vòng 3 ngày