Skip to content

Non-thread-safe SqliteStore @db initialization — double DB handle, leaked FD #582

Description

@sdghsdkjlas27-dotcom

sqlite_store.rb line 167-254: @db ||= SQLite3::Database.new(@path).tap { ... } is not thread-safe. Two threads can both see @db as nil and each open a separate SQLite connection. Both will run schema migrations and at_exit hooks independently. The losing thread's DB handle is leaked, and both connections may conflict on schema creation.

REPRODUCTION: Two concurrent Faraday requests hitting the SqliteStore simultaneously.

IMPACT: Database corruption, leaked file descriptors, duplicate schema migrations, duplicate at_exit handlers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions