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.
The Postgres/MariaDB stores call
this.pool?.end()unconditionally inclose(), 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
ownsClientflag (src/persistence/journals/CassandraJournal.ts:46-57). Object storage has the inverse bug: bothObjectStorageSnapshotStore.close()andObjectStorageDurableStateStore.close()close the same shared backend.Fix: add an
ownsPoolflag (mirrorownsClient) so an injected pool is never ended by a store; for object storage, close the backend once in the plugin aggregateclose(), not in each store.Part of Phase 1.