-
Notifications
You must be signed in to change notification settings - Fork 325
Closed as not planned
Labels
bugSomething isn't workingSomething isn't workingstaleNo recent activity has been detected on this issue/PR and it will be closedNo recent activity has been detected on this issue/PR and it will be closed
Description
Description
While EnsureDBInstalled() uses a mutex (ensureMux) to protect the installation process, the initial check IsDBInstalled() at line 56 happens outside the mutex lock. This creates a TOCTOU (Time-of-Check-Time-of-Use) race condition where two concurrent calls could both see the DB as not installed, then both proceed with installation (though the mutex will serialize the actual install).
Severity
MEDIUM - Race condition
Test Reference
Test: TestEnsureDBInstalled_Concurrent in pkg/db/db_local/install_test.go:167 (skipped)
Suggested Fix
Move the IsDBInstalled() check inside the mutex lock.
Related Code
pkg/db/db_local/install.go:39-54
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingstaleNo recent activity has been detected on this issue/PR and it will be closedNo recent activity has been detected on this issue/PR and it will be closed