-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
In what version(s) of Spring Integration are you seeing this issue?
5.5.10
Describe the bug
Usage of JdbcMessageStore eventually leads to the database connection pool depletion as the connections are not getting properly closed after streaming the messages. After a while, the application stops functioning correctly, as the database connection pool never receives those connections back and treats them as active.
This seems to happen on:
- message group expiration via the configured timeout
- explicit execution of a
MessageGroupStoreReaperinstance - streaming through the messages of a message group via
getMessages().stream()
The issue appears to be with the stream from PersistentMessageGroup#streamMessages not getting closed after the usage in certain cases.
To Reproduce
Set up the application with a limited database connection pool, configure an aggregation flow with an instance of JdbcMessageStore and a scheduled MessageGroupStoreReaper execution for that message store.
Expected behavior
Internal usages of the message store should properly release database connections when JdbcMessageStore is utilized.
If the current behavior of streaming on MessageGroup#getMessages is expected, the need for closing the stream should ideally be mentioned in the documentation.
Sample