fluss icon indicating copy to clipboard operation
fluss copied to clipboard

[client] Closing a KV snapshot scanner does not stop its download

Open polyzos opened this issue 2 weeks ago • 1 comments

Search before asking

  • [x] Searched the issues and found nothing similar.

Fluss version

1.0.0 (also present on main)

Problem

When a Flink job reads a primary-key table from a KV snapshot, each bucket's snapshot is downloaded to local disk in the background. Closing the scanner deletes the local directory, but it does not stop a download that is still running.

As a result, when a job is cancelled, stopped or fails over mid-download:

  • the download threads keep running and writing to disk;
  • the directory is removed underneath them;
  • the space can only be reclaimed by restarting the TaskManager.

Impact in Production

On a shared Flink session cluster, two jobs downloaded snapshots at about 130 MB/s. After both jobs were stopped, the downloads carried on. TaskManager disk use reached 53 GB and the pod was evicted. Restarting the TaskManager was the only way to stop the downloads, and that also restarted every other job running on it.

Proposed Fix

  • Keep a handle on the background download, and cancel it when the scanner closes, before deleting the directory.
  • Run downloads on an executor owned by the scanner instead of a shared pool, so they can be shut down cleanly.
  • Optionally, limit how much snapshot data a client downloads at once, or check free disk space before starting.

Willingness to contribute

  • [x] I'm willing to submit a PR!

polyzos avatar Nov 15 '26 07:11 polyzos

@polyzos it seems intresting, will give a fix, Thanks

pbanakar avatar Nov 19 '26 19:11 pbanakar