Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[server] Periodic KV snapshot initialization races with Replica deletion

オープン
#4,599 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@MaheshS08 がすでに取り組んでいます。

2026年10月13日 から。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
53/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java
領域
backend, databases

調査の方向性

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:

  1. Create a KV leader, write and flush records, and retain the snapshot timer automatically scheduled during leader initialization.
  2. 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.
  3. 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 ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/fluss のほかの issue

apache/fluss の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。