Skip to content

[LOW] unlockFile uses LoadOrStore instead of Load — panics on misuse #198

Description

@pradeepto

Description

pkg/filestore/filestore.go:286-290 and :297-300

The unlock functions use LoadOrStore which creates a new mutex if one does not exist. If unlockFile is ever called without a matching lockFile it creates a fresh mutex and calls Unlock() on it which panics (unlocking an unlocked mutex).

Load is the correct choice — it should be impossible to unlock a path that was never locked.

Fix

Use Load instead of LoadOrStore and handle the "not found" case as a programming error.

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