[FlightSQL] Statement.execute(String) can leak server prepared-statement handles when reused
- Lenguaje dominante
- Java
- Estrellas
- 94
- Forks
- 152
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 11
Descripción
### 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
Guía de contribución
Línea de trabajo
Comienza en la implementación JDBC de Flight SQL de Statement.execute(String) y sigue cómo se sustituyen y cierran los handles de prepared-statement; el issue no nombra ningún archivo ni test. Reproduce el bucle contra un servidor Flight SQL con estado y verifica después que cada handle anterior se libera antes de registrar el siguiente y que Statement.close sigue limpiando el handle final.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- databases
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 55/100