[FlightSQL] Statement.execute(String) can leak server prepared-statement handles when reused
- 主要語言
- Java
- 星號
- 94
- 分支
- 152
- 平均合併
- 3 天 16 小時
- 30 天內合併 PR
- 11
描述
### Describe the bug, including details regarding any error messages, version, and platform.
When reusing the same JDBC Statement and calling execute(String) multiple times, the Flight SQL JDBC path creates a new prepared statement on each call, but previous prepared handles are not closed before being replaced in client tracking state.
This means only the latest handle is guaranteed to be closed when the statement is closed. On stateful Flight SQL servers, this can leak server-side resources associated with older handles.
Repro
```
try (Connection connection = DriverManager.getConnection(jdbcUrl, properties);
Statement statement = connection.createStatement()) {
for (int i = 1; i <= n; i++) {
String sql = "SELECT " + i;
boolean isResultSet = statement.execute(sql);
if (isResultSet) {
try (ResultSet rs = statement.getResultSet()) {
while (rs.next()) { /* consume */ }
}
}
}
}
```
Raised in https://github.com/apache/arrow-java/pull/1090#discussion_r3132344585
貢獻指南
研究方向
從 Flight SQL 的 JDBC 實作中的 Statement.execute(String) 開始,追蹤 prepared-statement handles 如何被取代及關閉;該 issue 沒有指定檔案或測試。針對具狀態的 Flight SQL 伺服器重現此迴圈,然後確認每個先前的 handle 都會在下一個 handle 被追蹤之前釋放,且 Statement.close 仍會清理最後的 handle。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java
- 領域
- databases
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100