[server] Periodic KV snapshot initialization races with Replica deletion
Maintainer thường phản hồi trong vòng 1 ngày
@MaheshS08 đang làm issue này rồi.
Từ ngày 13/10/2026.
Đá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
- 53/100
Hướng nghiên cứu
Start with Replica.delete() and Replica.dropKv(), then trace how closeableRegistryForKv closes PeriodicSnapshotManager and how snapshot initialization runs under kvLock. Use the deterministic regression described in the issue with the existing ReplicaTest fixtures to reproduce the registry-closing window. Done means deletion stops or synchronizes periodic snapshot initialization before the KV registry closes, with the regression confirming no closed-registry IOException is logged.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Search before asking
- I searched in the issues and found nothing similar.
Fluss version
main (development)
Please describe the bug 🐞
Periodic KV snapshot initialization can race with Replica deletion and attempt to register resources after the Replica's KV registry has been closed.
java.io.IOException: Cannot register Closeable, registry is already closed. Closing argument.
at AbstractAutoCloseableRegistry.registerCloseable
at AsyncSnapshotCallable$AsyncSnapshotTask.<init>
at AsyncSnapshotCallable.toAsyncSnapshotFutureTask
at SnapshotRunner.snapshot
at KvTabletSnapshotTarget.initSnapshot
at PeriodicSnapshotManager.lambda$triggerSnapshot$2
Replica.dropKv() closes closeableRegistryForKv. The registry first sets closed=true, then closes its registered resources, including PeriodicSnapshotManager. A scheduled snapshot can still run between these steps and reach task registration while the registry is already closed.
The manager's close() also does not serialize with snapshot initialization under the tablet's kvLock, so cancelling the scheduled future alone does not cover an initialization already in progress.
Deterministic reproduction
A local regression uses the existing ReplicaTest fixtures and real Replica, RocksDB, snapshot target, runner and registry:
- Create a KV leader, write and flush records, and retain the snapshot timer automatically scheduled during leader initialization.
- Register a latch-controlled Closeable after the snapshot manager. Call
Replica.delete()on another thread and pause resource closing after the registry becomes closed, before the manager stops. - Execute the original scheduled timer, then release the latch and wait for deletion to finish.
This enlarges a valid closing window without mocking the initialization exception. The assertion that no closed-registry IOException is logged fails on both revisions:
| Regression | Base b530fcc2 |
PR #4492 19870c605 |
|---|---|---|
| Retry after snapshot-init failure | Fails: no replacement task | Passes |
| Snapshot initialization during Replica deletion | Fails: closed-registry IOException | Fails: same IOException |
Four occurrences were observed during test table deletion. Deletion completed, and no snapshot corruption was established.
Expected behavior
Replica deletion should stop or cancel periodic snapshots cleanly, without allowing snapshot task registration after the KV registry closes.
Solution
Serialize stopping the snapshot manager with snapshot initialization before closing the KV registry and dropping the tablet, while preserving cancellation and cleanup of already registered tasks.
Related: #4489 and #4492 address retry after initialization failure. The closing race exists before that PR and requires a separate lifecycle fix.
Are you willing to submit a PR?
- I'm willing to submit a PR!
- Ngôn ngữ chính
- Java
- Star
- 2.2k
- Fork
- 656
- Merge trung bình
- 2 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 97
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- 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 apache/fluss
-
[lake/iceberg] Reserved write-mode properties can be set and reset through their `iceberg.` keyCó thể đã có người làm @aphenix-r7 đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/fluss#4658 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[common] Decimal#hashCode is inconsistent with Decimal#equalsCó thể đã có người làm @firasbouzazi đã nhận 18 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
apache/fluss#4538 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[security] PlainSaslServerProvider conflicts with Hadoop SASL provider causing authentication failureCó thể đã có người làm @xinzhang-hello đã nhận 24 ngày trước. Đang mở
Độ khó 1/5 Dưới một 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
-
[server] KV snapshot scheduling stops permanently after a transient snapshot-init failureCó thể đã có người làm @zhang-arvin đã nhận 24 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
apache/fluss#4489 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[docs] Document advertised-resource and ACL principal ignore-case optionsCó thể đã có người làm @EchoLee5 đã nhận 36 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Ctrl + w should close dialogsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/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
ReChronoRain/HyperCeiler#1743 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Create CONTRIBUTING.mdĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ControlSystemStudio/phoebus#3979 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Cannot find symbol CTypedefCó thể đã có người làm @pellico đã nhận hôm nay. Đang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100