The GitHub Actions job "H2 Unit Tests" on 
pekko-persistence-jdbc.git/close-snapshot-blob-streams has succeeded.
Run started by GitHub user pjfanning (triggered by pjfanning).

Head commit for run:
7c25b7d09ba2200150e6698985fa317cb2c59ec1 / PJ Fanning 
<[email protected]>
Close the blob streams that snapshot payloads are read from

Motivation:
The Oracle snapshot column mapping converts a blob with
`blob.getBinaryStream.toArray`. `InputStreamOps.toArray` reads the stream to the
end but never closes it, and neither does the call site, so every snapshot that
is read from Oracle leaves a stream open. The stream is backed by driver
resources (a cursor or a temporary lob) that are only released when the
connection is returned or the garbage collector runs.

Modification:
Added `BlobOps.toArray`, which reads the blob and closes the stream in a
`finally` block, and used it in both the current and the legacy snapshot tables.

Result:
Reading snapshots from Oracle no longer leaks a stream per row.

Tests:
- sbt "core/testOnly org.apache.pekko.persistence.jdbc.util.BlobOpsSpec" - 
passed
- sbt "core/testOnly *H2*Snapshot*" - passed
- 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/34061876949

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to