Title: JDBC driver: Closing a Connection does not close ResultSets originated from the DatabaseMetadata API, potentially leading to exceptions related to memory leaks · Issue #990 · apache/arrow-java · GitHub
Open Graph Title: JDBC driver: Closing a Connection does not close ResultSets originated from the DatabaseMetadata API, potentially leading to exceptions related to memory leaks · Issue #990 · apache/arrow-java
X Title: JDBC driver: Closing a Connection does not close ResultSets originated from the DatabaseMetadata API, potentially leading to exceptions related to memory leaks · Issue #990 · apache/arrow-java
Description: Describe the bug, including details regarding any error messages, version, and platform. Very similar to #932 If a ResultSet obtained via a method from the DatabaseMetaData JDBC interface is not closed at the time of closing the connecti...
Open Graph Description: Describe the bug, including details regarding any error messages, version, and platform. Very similar to #932 If a ResultSet obtained via a method from the DatabaseMetaData JDBC interface is not cl...
X Description: Describe the bug, including details regarding any error messages, version, and platform. Very similar to #932 If a ResultSet obtained via a method from the DatabaseMetaData JDBC interface is not cl...
Opengraph URL: https://github.com/apache/arrow-java/issues/990
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"JDBC driver: Closing a Connection does not close ResultSets originated from the DatabaseMetadata API, potentially leading to exceptions related to memory leaks","articleBody":"### Describe the bug, including details regarding any error messages, version, and platform.\n\nVery similar to https://github.com/apache/arrow-java/issues/932\n\nIf 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.\n\nCode to reproduce:\n\n```\n try {\n\n // Establish connection\n\n Connection connection = DriverManager.getConnection(jdbcUrl, properties);\n\n DatabaseMetaData metaData = connection.getMetaData();\n // any other method that returns a ResultSet would also repro\n ResultSet rs = metaData.getTableTypes();\n // this eliminates the exception\n // rs.close(); \n\n connection.close();\n\n } catch (Exception e) {\n System.err.println(\"Error: \" + e.getMessage());\n e.printStackTrace();\n }\n\n```\n\nResulting in the following exception (under version 18.3.0)\n\n\n```\nJan 27, 2026 2:02:59 AM org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.memory.BaseAllocator close\nSEVERE: Memory was leaked by query. Memory leaked: (64)\nAllocator(VectorSchemaRootTransformer) 0/64/64/9223372036854775807 (res/actual/peak/limit)\n\nError: Exception while closing: Memory was leaked by query. Memory leaked: (64)\nAllocator(VectorSchemaRootTransformer) 0/64/64/9223372036854775807 (res/actual/peak/limit)\n\njava.sql.SQLException: Exception while closing: Memory was leaked by query. Memory leaked: (64)\nAllocator(VectorSchemaRootTransformer) 0/64/64/9223372036854775807 (res/actual/peak/limit)\n\n\tat org.apache.arrow.driver.jdbc.shaded.org.apache.calcite.avatica.Helper.createException(Helper.java:56)\n\tat org.apache.arrow.driver.jdbc.shaded.org.apache.calcite.avatica.Helper.createException(Helper.java:41)\n\tat org.apache.arrow.driver.jdbc.ArrowFlightConnection.close(ArrowFlightConnection.java:190)\n\tat MemoryLeakRepro.main(MemoryLeakRepro.java:136)\nCaused by: java.lang.RuntimeException: Exception while closing: Memory was leaked by query. Memory leaked: (64)\nAllocator(VectorSchemaRootTransformer) 0/64/64/9223372036854775807 (res/actual/peak/limit)\n\n\tat org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.util.AutoCloseables.closeNoChecked(AutoCloseables.java:211)\n\tat java.base/java.lang.Iterable.forEach(Iterable.java:75)\n\tat org.apache.arrow.driver.jdbc.ArrowFlightConnection.close(ArrowFlightConnection.java:185)\n\t... 1 more\nCaused by: java.lang.IllegalStateException: Memory was leaked by query. Memory leaked: (64)\nAllocator(VectorSchemaRootTransformer) 0/64/64/9223372036854775807 (res/actual/peak/limit)\n\n\tat org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.memory.BaseAllocator.close(BaseAllocator.java:504)\n\tat org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.util.AutoCloseables.closeNoChecked(AutoCloseables.java:209)\n\t... 3 more\n\n\n```\n","author":{"url":"https://github.com/ennuite","@type":"Person","name":"ennuite"},"datePublished":"2026-01-27T02:12:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/990/arrow-java/issues/990"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:412b0986-f73c-7b89-1d6a-808cd3603c02 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AB94:3B16A6:7C0B923:AE141BF:6A503C36 |
| html-safe-nonce | 0c777182882ced21b7ba385d60a1fce7d7b985a82b15f28779469b63de520e46 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQjk0OjNCMTZBNjo3QzBCOTIzOkFFMTQxQkY6NkE1MDNDMzYiLCJ2aXNpdG9yX2lkIjoiMjg1NTI2NjIxODMyMjk2NzYwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7009bf88be3b7827dde38c2f79edc127be99244c2a1010ee8d7040b7b37c2f1f |
| hovercard-subject-tag | issue:3858469402 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/apache/arrow-java/990/issue_layout |
| twitter:image | https://opengraph.githubassets.com/57c5a01d5fc59b1c22fbcfbd968dce87180d856dddb42d2cc1cc416334ff9d53/apache/arrow-java/issues/990 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/57c5a01d5fc59b1c22fbcfbd968dce87180d856dddb42d2cc1cc416334ff9d53/apache/arrow-java/issues/990 |
| og:image:alt | Describe the bug, including details regarding any error messages, version, and platform. Very similar to #932 If a ResultSet obtained via a method from the DatabaseMetaData JDBC interface is not cl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ennuite |
| hostname | github.com |
| expected-hostname | github.com |
| None | d6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb |
| turbo-cache-control | no-preview |
| go-import | github.com/apache/arrow-java git https://github.com/apache/arrow-java.git |
| octolytics-dimension-user_id | 47359 |
| octolytics-dimension-user_login | apache |
| octolytics-dimension-repository_id | 893682219 |
| octolytics-dimension-repository_nwo | apache/arrow-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 893682219 |
| octolytics-dimension-repository_network_root_nwo | apache/arrow-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d90666eaf032b7eb8975a378efe38e37f4ebb96c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width