Skip to content

db: share SQLite memory databases across connections - #236

Open
yperbasis wants to merge 2 commits into
ethpandaops:masterfrom
yperbasis:fix/sqlite-shared-memory
Open

yperbasis wants to merge 2 commits into
ethpandaops:masterfrom
yperbasis:fix/sqlite-shared-memory

Conversation

@yperbasis

@yperbasis yperbasis commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

The default SQLite connection string, :memory:?cache=shared, opens a separate in-memory database for each pooled connection. Concurrent reads and writes can then fail with no such table: task_results or task_logs, even after migrations succeed. This caused an Erigon Kurtosis CI failure.

Treat bare :memory: as shared memory and normalize in-memory connection strings with query parameters to SQLite's file: URI form. Append the WAL option with & when a query is already present, so existing parameters remain valid. This fixes the current default and existing configurations that use it.

The regression test holds one connection open and reads a saved task log through a second connection. Before the fix, it failed with no such table: task_logs. After the fix, it passes for bare and default memory strings, standard and named memory URIs, and a database file.

@yperbasis
yperbasis marked this pull request as ready for review October 1, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant