You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by GitBox <gi...@apache.org> on 2026/09/06 22:07:08 UTC
[GH] (pekko-persistence-jdbc/close-leaked-slick-databases): Workflow run "MySQL Integration Tests" failed!
The GitHub Actions job "MySQL Integration Tests" on pekko-persistence-jdbc.git/close-leaked-slick-databases has failed.
Run started by GitHub user pjfanning (triggered by pjfanning).
Head commit for run:
b2ea4998b9ace97100bf73899c5e347156572eb6 / PJ Fanning <pj...@users.noreply.github.com>
Close Slick databases that are created but never closed
Motivation:
`DefaultSlickDatabaseProvider` creates a new `Database` (and therefore a new
connection pool with its own threads) for every call that does not use
`use-shared-db`. The journal, snapshot store and read journal close the database
they requested, but three callers never do:
- `JdbcDurableStateStoreProvider` creates an eager database and neither closes it
nor registers a shutdown hook, so its connection pool outlives the actor system.
- `SchemaUtilsImpl` creates a database for every `createIfNotExists`,
`dropIfExists` and `applyScript` call and drops the reference to it.
- `JournalMigrator` and `SnapshotMigrator` open one and two databases
respectively and offer no way to close them.
Modification:
- `JdbcDurableStateStoreProvider` registers `db.close()` on actor system
termination when it owns the database, the same as `JdbcReadJournal` does.
- `SchemaUtilsImpl` registers the databases it creates for closing on actor
system termination. The database is deliberately not closed as soon as the
script has been applied, because that would drop an H2 in-memory database
together with the schema that was just created.
- `JournalMigrator` and `SnapshotMigrator` implement `AutoCloseable` and close
the databases they opened. Shared databases (`use-shared-db`) are left alone
in all three cases, since those are owned by the actor system.
Result:
Connection pools that this library creates are closed again, instead of living
on until the JVM exits.
Tests:
- sbt "core/testOnly org.apache.pekko.persistence.jdbc.state.JdbcDurableStateStoreProviderSpec org.apache.pekko.persistence.jdbc.testkit.internal.SchemaUtilsImplSpec" - passed (both fail without the fix)
- sbt "migratorIntegration/testOnly org.apache.pekko.persistence.jdbc.migrator.MigratorCloseTest" - passed
- sbt "core/testOnly *H2*" - 217 passed, 1 failed: H2ScalaCurrentEventsByTagTest "should complete without any gaps in case events are being persisted when the query is executed", which fails the same way on an unmodified checkout of main
- sbt "core/mimaReportBinaryIssues" - passed
- scalafmt --mode diff-ref=upstream/main - no changes
References:
None - found while reviewing the main sources for resource leaks
Report URL: https://github.com/apache/pekko-persistence-jdbc/actions/runs/34062584176
With regards,
GitHub Actions via GitBox
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org