Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
avatica-1.13.0
-
CentOS release 6.9 (Final)
Description
Kylin's JDBC Driver(https://github.com/apache/kylin/tree/master/jdbc) is based on Avatica. While using Kylin JDBC Driver, if repeatedly invoking
//code from Application code. Driver driver = (Driver) Class.forName("org.apache.kylin.jdbc.Driver").newInstance();
, which repeatedly invokes
//code from Kylin JDBC DriverVersion version = DriverVersion.load(Driver.class, "org-apache-kylin-jdbc.properties", "Kylin JDBC Driver", "unknown version", "Kylin", "unknown version");
Then the native memory leak can be observed, see attached memory profile diagram(from jeprof).
And the leaking stack trace is below.
at java.util.zip.Inflater.inflate
at java.util.zip.InflaterInputStream.read()
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at java.util.Properties$LineReader.readLine(Properties.java:435)
at java.util.Properties.load0(Properties.java:353)
at java.util.Properties.load(Properties.java:341)
at org.apache.kylin.jdbc.shaded.org.apache.calcite.avatica.DriverVersion.load(DriverVersion.java:104)
at org.apache.kylin.jdbc.Driver.createDriverVersion(Driver.java:88)
at org.apache.kylin.jdbc.shaded.org.apache.calcite.avatica.UnregisteredDriver.<init>(UnregisteredDriver.java:56)
at org.apache.kylin.jdbc.Driver.<init>(Driver.java:70)
By inspecting the Avatica code, the InputStream was not closed after use.
//code from Avatica DriverVersion.load final InputStream inStream = driverClass.getClassLoader().getResourceAsStream(resourceName);
Though it is nonsense to calling DriverVersion.load repeatedly, but the leak is there.
The code to reproduce the leak is at https://github.com/leonliao/calcite-avatica-driver-version-test. Follow the README to reproduce the problem.
Attachments
Attachments
Issue Links
- links to