Race Condition Issue in PostgreSQL SSL Connection Process
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 32/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js, postgresql
- Lĩnh vực
- databases, networking, security
Hướng nghiên cứu
Bắt đầu trong lib/connection.js và theo dõi cách stream.connect(), sự kiện TCP 'connect', requestSsl() và listener 'data' của stream phối hợp với nhau trong quá trình kết nối PostgreSQL thông qua RDS Proxy. Nếu có thể, hãy tái hiện hiện tượng ngắt kết nối TLS không liên tục và so sánh với một kết nối PostgreSQL trực tiếp. Hoàn tất có nghĩa là xác nhận hoặc bác bỏ giả thuyết về điều kiện tranh chấp, đồng thời ghi lại một biện pháp giảm thiểu hoặc bản sửa lỗi cụ thể.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have been encountering "Error: Client network socket disconnected before secure TLS connection was established" errors recently without any specific cause when connecting to PostgreSQL through RDS Proxy. These errors occur intermittently, making them difficult to reproduce consistently.
After examining the code in the pg module's lib/connection.js file, I suspect there is a race condition issue between the TCP connection and TLS connection process. The architecture of the connection flow appears problematic:
- Client initiates TCP connection (stream.connect(port, host))
- When TCP connection succeeds, a 'connect' event is emitted
- However, the code for SSL/TLS connection is not directly linked to the 'connect' event
- Instead, logic to wait for the server's SSL support response is set up separately (stream.once('data', function (buffer) {...})
This design creates potential timing issues because:
- There's no explicit synchronization between the TCP connection establishment and when requestSsl() is called
- The SSL handshake process depends on event listeners that operate asynchronously
- When working with RDS Proxy as an intermediary layer, these timing sensitivities may become more problematic
I've verified this by testing direct connections to PostgreSQL without RDS Proxy, which work consistently. The issue only manifests when connecting through the proxy layer.
Please check if my understanding of this potential race condition is correct, and if there are any recommended approaches to mitigate this issue.
- Ngôn ngữ chính
- JavaScript
- Star
- 13.2k
- Fork
- 1.4k
- Merge trung bình
- 6 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 6
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của brianc/node-postgres
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
brianc/node-postgres#3770 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
brianc/node-postgres#3716 · 1 bình luận ·
-
# remove bring your own promise Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
brianc/node-postgres#3631 · 1 bình luận ·
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 62/100
brianc/node-postgres#2857 ·
-
can't view docs for old versions Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
brianc/node-postgres#2433 ·
Tất cả issue của brianc/node-postgres
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mksglu/context-mode#1200 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
neondatabase/website#5944 ·
-
module: core
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
bigbluebutton/bigbluebutton#25849 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
jaegertracing/jaeger-ui#4506 ·