[server] Periodic KV snapshot initialization races with Replica deletion
メンテナーはふだん 1 日以内に返信
@MaheshS08 がすでに取り組んでいます。
2026年10月13日 から。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 53/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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!
- 主要言語
- Java
- スター
- 2.2k
- フォーク
- 656
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 106
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/fluss のほかの issue
-
[lake/iceberg] Reserved write-mode properties can be set and reset through their `iceberg.` key対応中かも @aphenix-r7 が 6 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/fluss#4658 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[common] Decimal#hashCode is inconsistent with Decimal#equals対応中かも @firasbouzazi が 17 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/fluss#4538 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[security] PlainSaslServerProvider conflicts with Hadoop SASL provider causing authentication failure対応中かも @xinzhang-hello が 23 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
[server] KV snapshot scheduling stops permanently after a transient snapshot-init failure対応中かも @zhang-arvin が 23 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
apache/fluss#4489 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[docs] Document advertised-resource and ACL principal ignore-case options対応中かも @EchoLee5 が 35 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug/错误
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
FCL-Team/FoldCraftLauncher#1951 ·
メンテナーはふだん 4 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
quarkusio/quarkus-agent-mcp#296 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
commons-app/apps-android-commons#7072 ·
メンテナーはふだん 1 日以内に返信
-
enhancement web-ui
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
jenkinsci/jenkins#27583 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100