-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReadWriteSplittingPlugin does not close the reader connection #547
Comments
Hi @firebike, Thanks for reaching out and raising this issue, as well as for creating a PR. We'll take a look at this and keep you updated as we investigate and review your proposed changes. Thank you for your patience! |
Hi @firebike, I've left a suggestion on your PR. Also, regarding the warning message you've been getting about the unrecognized node type, it seems to have been an issue with Aurora PostgreSQL, in at least version 14.7. It was addressed in versions 14.8 and 15.3. |
Hi @firebike, We've merged your PR and the fix is now available in the latest snapshot build. To confirm, did the fix resolve the out of memory errors, or does the error persist? |
Hi @crystall-bitquill I'm on vacation now. @datenbrille could you please answer this question? |
Closing this ticket as the fix has been confirmed to work in this comment. |
Describe the bug
When
ReadWriteSplittingPlugin
switches back to the writer connection, the reader connection is still held and is not being closed. In effect, the reader connection is permanently bound to the writer connection and is not returned to the internal reader connection pool.Expected Behavior
ReadWriteSplittingPlugin
closes the reader connection after switching back to the read-write mode.What plugins are used? What other connection properties were set?
awsSecretsManager,readWriteSplitting,failover,efm
Current Behavior
Our application has started reporting OutOfMemoryErrors. Heap dump analysis shown that the memory has been occupied by PGConnection instances, in particular by PSQLWarnings accumulated by the reader connections.
When an aws-wrapper jdbc connection is switched from write to read mode, the backing internal reader connection is initialized using the following SQL statement
SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED
Aurora executes the statement but also returns a warning
unrecognized node type: 378
:These warnings are kept by the PGConnection.
Reproduction Steps
In our project we name the Hikari connection pools
core-writer
andcore-reader
.We use internal connection pooling
Here are the stats of our Hikari pools after a long running stimulus followed by a cool-down period:
It’s visible, that the reader connections were not returned to the pool.
Possible Solution
Close the reader connection after switching back to the writer connection.
I've patched the
ReadWriteSplittingPlugin
With that change in place the reader connections are properly returned to the pool
Additional Information/Context
We use Aurora for Postgres version 14.7
The AWS Advanced JDBC Driver version used
2.1.2, 2.2.2
JDK version used
17.0.7
Operating System and version
Linux pop-os 6.2.6-76060206-generic
The text was updated successfully, but these errors were encountered: