Skip to content

[Bug] Injected shared pool ended by individual store close() (Postgres/MariaDB); object-storage backend double-close #378

Description

@pathosDev

The Postgres/MariaDB stores call this.pool?.end() unconditionally in close(), even when the pool was injected and shared across the journal + snapshot + durable-state stores (the arrangement the plugin JSDoc recommends).

Evidence (all six PG/Maria stores): src/persistence/journals/PostgresJournal.ts:183, MariaDbJournal.ts:167, snapshot-stores/PostgresSnapshotStore.ts:97, MariaDbSnapshotStore.ts:99, durable-state-stores/PostgresDurableStateStore.ts:123, MariaDbDurableStateStore.ts:124. Closing one store ends the pool out from under the others.

Cassandra already solves this with an ownsClient flag (src/persistence/journals/CassandraJournal.ts:46-57). Object storage has the inverse bug: both ObjectStorageSnapshotStore.close() and ObjectStorageDurableStateStore.close() close the same shared backend.

Fix: add an ownsPool flag (mirror ownsClient) so an injected pool is never ended by a store; for object storage, close the backend once in the plugin aggregate close(), not in each store.

Part of Phase 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: mediumUseful, not urgent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions