ennuite opened a new issue, #990:
URL: https://github.com/apache/arrow-java/issues/990

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Very similar to https://github.com/apache/arrow-java/issues/932
   
   If a `ResultSet` obtained via a method from the `DatabaseMetaData` JDBC 
interface is not closed at the time of closing the connection, an exception is 
thrown in `Connection.close()` This is separate from the linked bug, because 
the other one only contemplated `ResultSets` that originate in queries made via 
`Statements`. However, the behavior is very similar.
   
   Code to reproduce:
   
   ```
       try {
   
         // Establish connection
   
         Connection connection = DriverManager.getConnection(jdbcUrl, 
properties);
   
         DatabaseMetaData metaData = connection.getMetaData();
         // any other method that returns a ResultSet would also repro
         ResultSet rs = metaData.getTableTypes();
         // this eliminates the exception
         // rs.close(); 
   
         connection.close();
   
       } catch (Exception e) {
         System.err.println("Error: " + e.getMessage());
         e.printStackTrace();
       }
   
   ```
   
   Resulting in the following exception (under version 18.3.0)
   
   
   ```
   Jan 27, 2026 2:02:59 AM 
org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.memory.BaseAllocator close
   SEVERE: Memory was leaked by query. Memory leaked: (64)
   Allocator(VectorSchemaRootTransformer) 0/64/64/9223372036854775807 
(res/actual/peak/limit)
   
   Error: Exception while closing: Memory was leaked by query. Memory leaked: 
(64)
   Allocator(VectorSchemaRootTransformer) 0/64/64/9223372036854775807 
(res/actual/peak/limit)
   
   java.sql.SQLException: Exception while closing: Memory was leaked by query. 
Memory leaked: (64)
   Allocator(VectorSchemaRootTransformer) 0/64/64/9223372036854775807 
(res/actual/peak/limit)
   
        at 
org.apache.arrow.driver.jdbc.shaded.org.apache.calcite.avatica.Helper.createException(Helper.java:56)
        at 
org.apache.arrow.driver.jdbc.shaded.org.apache.calcite.avatica.Helper.createException(Helper.java:41)
        at 
org.apache.arrow.driver.jdbc.ArrowFlightConnection.close(ArrowFlightConnection.java:190)
        at MemoryLeakRepro.main(MemoryLeakRepro.java:136)
   Caused by: java.lang.RuntimeException: Exception while closing: Memory was 
leaked by query. Memory leaked: (64)
   Allocator(VectorSchemaRootTransformer) 0/64/64/9223372036854775807 
(res/actual/peak/limit)
   
        at 
org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.util.AutoCloseables.closeNoChecked(AutoCloseables.java:211)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at 
org.apache.arrow.driver.jdbc.ArrowFlightConnection.close(ArrowFlightConnection.java:185)
        ... 1 more
   Caused by: java.lang.IllegalStateException: Memory was leaked by query. 
Memory leaked: (64)
   Allocator(VectorSchemaRootTransformer) 0/64/64/9223372036854775807 
(res/actual/peak/limit)
   
        at 
org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.memory.BaseAllocator.close(BaseAllocator.java:504)
        at 
org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.util.AutoCloseables.closeNoChecked(AutoCloseables.java:209)
        ... 3 more
   
   
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to