Skip to content

cache: temporary cache directories are never removed #97

Open

Description

@zfarrell

Found by a memory-accounting audit of 8b3c813. The tests are on branch audit/memory-tests and fail on main today; check out that branch to run them. File and line links point at that commit.

What goes wrong. When no store is given, build() creates tempfile::tempdir().unwrap().keep() (src/core/src/cache/builders.rs:138) and never deletes it. The server does the same (src/datafusion-server/src/lib.rs:141). Each leaked directory holds a t4 file that can grow up to the disk budget.

Evidence. The temporary directory outlived the cache, still containing a 4,096-byte liquid_cache.t4. The server behaves the same.

Tests.

Test File Command Flags
audit_default_cache_temp_dir_is_removed_on_drop src/core/src/cache/builders_audit_tests.rs:61 cargo +1.96.0 test -p liquid-cache --lib audit_default_cache_temp_dir_is_removed_on_drop -- --nocapture uses the test-only AUDIT_TEMP_DIRS hook in build()
audit_service_temp_dir_is_removed_on_drop src/datafusion-server/src/tests/audit_config.rs:78 cargo +1.96.0 test -p liquid-cache-datafusion-server --lib audit_service_temp_dir_is_removed_on_drop -- --nocapture

Flags: P probabilistic (a pass after a fix only means the race wasn't hit), F interleaving forced by a test hook, L Linux only, D needs Docker, M measurement only, C control (passes by design).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions