Skip to content

Several Dao make use of jOOQ stream() without closing #1567

@rma-rripken

Description

@rma-rripken

Several Dao make use of jOOQ's stream() but don't explicitly close the stream. This does not seem to be causing any immediate issues but in trying to debug WaterSupplyAccounting in my IDE I noticed several tests that were triggering Tomcat's abandoned connection warning and noticed that some of the tests in LevelsControllerTestIT were taking extreme amounts of time (4-5 minutes per test). When the streams were wrapped in try-with-resources those same tests complete in seconds.
I looked in the github environment and I didn't see any of the tests there taking crazy amounts of time so maybe this is only a problem when the tests are run in the debugger?
If we're supposed to be closing these streams seems like we should be doing it correctly whether they are currently showing problems or not.

This link suggests that users must close jooq streams: jOOQ/jOOQ#4932 I'm sure there are other jOOQ documentation pages that explain this better.

I'd suggest just adding try-with-resource around the existing stream() calls and not trying to rewrite anything.

These are the Dao that are affected:
LocationGroupDao
LocationLevelsDaoImpl
LocationsDaoImpl
PoolDao
TimeSeriesIdentifierDescriptorDao
TimeZoneDao
StandardTextDao

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions