[CONJ-513] Connector/J Leaking socket file descriptors when using unix domain sockets Created: 2017-08-23 Updated: 2022-09-05 Resolved: 2021-04-08 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | Other |
| Affects Version/s: | 1.6.3 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Robert Goley | Assignee: | Diego Dupin |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 12.04 and Ubuntu 14.04 JDK version : Zulu-7 7.20.0.3 <dependency> <dependency> <dependency> <dependency> <dependency>
|
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
We have a servlet application running in Tomcat 7 that is leaking socket files. I have tracked it back to the idle timeout reaping of connections. The leaked socket fd count increases by exactly the number of connections in the hibernate.hikari.maximumPoolSize setting (20) at exactly the idle timeout reaping interval. This happens without the application logged in or doing anything. You can watch the /proc/$PID/fd directory and just see the file descriptor count increase. I will attach pom and other setup files for reference. This only happens when using the connector/j jdbc driver with a url that uses unix domain sockets. It does not happen with regular TCP/IP connections to the localhost server. I believe that either the connector/j is leaving a leftover socket file open in the app when the connection is closed or that the particular usage from hibernate-hikaricp doesn't allow it to clean up that last connection piece. |
| Comments |
| Comment by Diego Dupin [ 2017-08-31 ] |
|
reproduced using pool hikaricp, without, it doesn't seem to occur. Now analysing |
| Comment by Diego Dupin [ 2017-09-04 ] |
|
Erronous last comment, those socket where not due to pooling/connections. Can you add result of folowing command : "lsof -a -p <pid>" and "netstat -v" ? |
| Comment by Robert Goley [ 2017-09-05 ] |
|
Just added the captured output of both commands. It is the large number of socket file descriptors with the "can't identify protocol" description that grows when the socket pool idleTimeout is reached that seems to be the problem. This happens using a JDBC connection url like "jdbc.url=jdbc:mariadb://localhost:3306/appname?localSocket=/var/run/mysqld/mysqld.sock" that uses unix domain sockets but not one like jdbc.url=jdbc:mariadb://localhost:3306/appname" that only uses TCP/IP sockets. |
| Comment by Robert Goley [ 2017-11-07 ] |
|
This issue is specific to using the JNA unix socket option with hibernate-hikaricp 5.1.3 which includes hikaricp 2.3.x. This is regularly reproducible with it. Every time the maxLifetime period is reached, the number of socket file descriptors is increased by the number of minimumIdle connections specified. However, dropping hibernate-hikaricp in favor of the HikariCP-java7 (2.4.13) resolves this issue without changing any other setting. That would seem to show the issue is actually with HikariCP 2.3.x and not the MariaDB Connector/J. |
| Comment by Diego Dupin [ 2021-04-08 ] |
|
closing because not reproduced, and stalled for 4 years |