-
Notifications
You must be signed in to change notification settings - Fork 49
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
Leaking: org.apache.http.impl.conn.PoolingHttpClientConnectionManager #343
Comments
Hi @abedali, thank you for raising this. To help us investigate the issue, would you be able to answer the following questions?
Thank you. |
@karenc-bq thanks for your response. Its a spring boot application driverClassName: software.aws.rds.jdbc.mysql.Driver I've enabled logging, by supplying 'logger=Slf4JLogger' in the connection string properties, but didn't help much interms of logging. Its outputting sql statements. Please help! |
Hi @abedali, thank you for providing the configurations. Based on the configuration you have provided, the connections are not leaking and this is the expected behaviour of Hikari. HikariCP keeps a number of idle connections in the background to satisfy the As a quick verification, do you still see the same issue if you set |
@karenc-bq I've put logging.level.org.apache.http: DEBUG, and min jdbc idle connections are set to 5. Those many instaces of PoolingHttpClientConnectionManager are created and left idle. The screenshot explains the increase in the number of instances of the PoolingHttpClientConnectionManager objects in heap. Hope the following logs would help in better understanding. Thank you and please help! 18-01-2023 12:28:31.705 LOGINHikariPool housekeeper [DEBUG] HikariPool - LOGINHikariPool - Before cleanup stats (total=5, active=0, idle=5, waiting=0) |
Just want to see if I can add some clarity to this issue. We have noticed a slow memory leak in services using the driver. Heap dumps show an enormous number of PoolingHttpClientConnectionManager instances on the heap. We have now demonstrated that the event of closing expired connections and opening new ones adds an instance of PoolingHttpClientConnectionManager and these do not seem to ever be cleaned up. The number of additional instances is exactly the same as the minimum pool size and they grow at a time defined by the idle timeout. |
By disabling AWSSecretsManagerPluginFactory, the PoolingHttpClientConnectionManager instances are not increasing now |
The disabling of the AWSSecretsManagerPluginFactory was done as a test to prove our guess, but it is not a solution for us as we really need the secrets manager approach to work properly. It seems the AWSSecretsManagerPluginFactory is the problem. |
Hello @abedali |
Hi @abedali, thank you for raising this issue. The fix has been merged, can you please kindly checkout our snapshot build and let us know if the issue persists? Thank you. |
@karenc-bq Appreciate your quick turnaround. I don't see the issue anymore using snapshot version of the library 'aws-mysql-jdbc-1.1.4-20230126.000534-6'. |
We've released a new version of the driver that resolves this issue. Please download the latest 1.1.4 version of the driver. We'll be closing this ticket. Thank you |
Describe the bug
HikariCP: 4.0.3
aws-mysql-jdbc: 1.1.1
Hikari DataSource maxLifetime is set to 2mins,
As per our observations in JVM runtime, PoolingHttpClientConnectionManager is leaking connections and the number of instances spiking in the heap is based on Hikari's maxLifetime.
This is a serious problem.
As an alternative, we would like to explore (UrlConnectionHttpClient)
https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/http-configuration-url.html
How do we configure this in the connection?
Expected Behavior
Reuse org.apache.http.impl.conn.PoolingHttpClientConnectionManager instance
instead of re-creating
Current Behavior
Driver creates org.apache.http.impl.conn.PoolingHttpClientConnectionManager instance everytime a new connection is established and the number of instances is 5 at minimum.
Reproduction Steps
HikariCP: 4.0.3
aws-mysql-jdbc: 1.1.1
Hikari DataSource maxLifetime is set to 2mins and monitor the number of instances of
org.apache.http.impl.conn.PoolingHttpClientConnectionManager
Possible Solution
Reuse org.apache.http.impl.conn.PoolingHttpClientConnectionManager instance
instead of re-creating
Additional Information/Context
No response
The AWS JDBC Driver for MySQL version used
1.1.1
JDK version used
OpenJDK Runtime Environment Corretto-8.352.08.1 (build 1.8.0_352-b08)
Operating System and version
Linux amzn2 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: