[FlightSQL] Statement.execute(String) can leak server prepared-statement handles when reused

Đang mở
#1,129 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
java
Lĩnh vực
databases

Hướng nghiên cứu

Bắt đầu từ triển khai JDBC của Flight SQL cho Statement.execute(String) và theo dõi cách các prepared-statement handles được thay thế và đóng; issue không nêu tên file hay test nào. Tái hiện vòng lặp với một máy chủ Flight SQL có trạng thái, sau đó xác minh rằng mỗi handle trước đó được giải phóng trước khi handle tiếp theo được theo dõi và Statement.close vẫn dọn dẹp handle cuối cùng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Type: bug
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

Ngôn ngữ chính
Java
Star
95
Fork
154
Merge trung bình
2 ngày 10 giờ
Pull request đã merge (30 ngày)
11

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/arrow-java

Tất cả issue của apache/arrow-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.