Skip to content

Proper Shutdown of BackgroundBlock Cache is required #2008

@googlyrahman

Description

@googlyrahman

The BackgroundBlockCache contains a flaw where closing the file fails to shut down the background data-fetching thread.

Currently, the close() method merely discards the cache reference, leaving the ThreadPoolExecutor and its pending download tasks actively running in the background. This oversight wastes network and memory capacity on a closed file and can cause a continuous buildup of dangling threads that might eventually crash or hang the application.

To resolve this, the cache class needs a dedicated shutdown method to explicitly cancel any active futures and terminate the executor, and this new teardown logic must be invoked directly inside the close() method before the cache object is dropped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions