Connections can get stuck when upgrading to SSL
Maintainer thường phản hồi trong vòng 1 ngày
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
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- erlang
- Lĩnh vực
- networking
Hướng nghiên cứu
Bắt đầu trong src/hackney_conn.erl tại hackney_conn:connected/3 và lời gọi ssl:connect/2, sau đó theo dõi cách một kết nối trong pool hoạt động trong khi TLS handshake đang chờ. Xác nhận hành vi timeout tùy chọn mong muốn và xác định các bài kiểm thử kết nối liên quan; hoàn thành khi một lần nâng cấp TLS thất bại hoặc bị đình trệ không còn chiếm một kết nối trong pool vô thời hạn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
- hackney: 4.7.2
- Erlang/OTP: 26
Description
I observed a behavior in an integration environment where the default connection pool becomes fully occupied by connections which were stuck attempting to upgrade to SSL. Within hackney_con:connected there is a call to ssl:connect/2 which results in utilizing the default timeout of infinity. If an issue occurs during the TLS handshake, the connection process remains in a waiting state and attempts to utilize the connection time out repeatedly as the call to hackney:maybe_register_h2/6 must pull the protocol from the state of the pooled connection which times out.
Is it possible to implement a concept of tls upgrade timeout or tls handshake timeout which can be optionally passed to an ssl:connect/3 call in the upgrade to TLS path?
More Details
Hackney Connection Supervisor has 4 linked processes in the pool and appears in a healthy state
[{registered_name,hackney_conn_sup},
{current_function,{gen_server,loop,7}},
{initial_call,{proc_lib,init_p,5}},
{status,waiting},
{message_queue_len,0},
{links,[<0.663122.0>,<0.663147.0>,<0.663279.0>,<0.663134.0>,
<0.1568.0>]},
{dictionary,[{'$ancestors',[hackney_sup,<0.1567.0>]},
{'$initial_call',{supervisor,hackney_conn_sup,1}}]},
{trap_exit,true},
{error_handler,error_handler},
{priority,normal},
{group_leader,<0.1566.0>},
{total_heap_size,2208},
{heap_size,1598},
{stack_size,11},
{reductions,865131},
{garbage_collection,[{max_heap_size,#{error_logger => true,include_shared_binaries => false,
kill => true,size => 0}},
{min_bin_vheap_size,46422},
{min_heap_size,233},
{fullsweep_after,65535},
{minor_gcs,35}]},
{suspending,[]}]
One of the connections in the pool is inspected and is found in the waiting state with two messages in the queue. Connection is waiting on ssl handshake to complete
23> process_info(<0.663122.0>).
[{current_function,{gen,do_call,4}},
{initial_call,{proc_lib,init_p,5}},
{status,waiting},
{message_queue_len,2},
{links,[<0.1570.0>]},
{dictionary,[{'$ancestors',[hackney_conn_sup,hackney_sup,
<0.1567.0>]},
{'$initial_call',{hackney_conn,init,1}}]},
{trap_exit,true},
{error_handler,error_handler},
{priority,normal},
{group_leader,<0.1566.0>},
{total_heap_size,3203},
{heap_size,1598},
{stack_size,47},
{reductions,14839},
{garbage_collection,[{max_heap_size,#{error_logger => true,include_shared_binaries => false,
kill => true,size => 0}},
{min_bin_vheap_size,46422},
{min_heap_size,233},
{fullsweep_after,65535},
{minor_gcs,9}]},
{suspending,[]}]
26> process_info(<0.663122.0>, [current_stacktrace]).
[{current_stacktrace,[{gen,do_call,4,
[{file,"gen.erl"},{line,240}]},
{gen_statem,call,3,[{file,"gen_statem.erl"},{line,923}]},
{ssl_gen_statem,call,2,
[{file,"ssl_gen_statem.erl"},{line,1372}]},
{ssl_gen_statem,handshake,2,
[{file,"ssl_gen_statem.erl"},{line,253}]},
{ssl_gen_statem,connect,8,
[{file,"ssl_gen_statem.erl"},{line,222}]},
{ssl,connect,3,[{file,"ssl.erl"},{line,637}]},
{hackney_conn,connected,3,
[{file,"/codebuild/output/src3735438855/src/mirror/_build/default/lib/hackney/src/hackney_conn.erl"},
{line,909}]},
{gen_statem,loop_state_callback,11,
[{file,"gen_statem.erl"},{line,1395}]}]}]
At this point in time I am not exactly sure what failure occurred to cause the handshake attempt to fail in this way so I can not reliably reproduce this issue. Regardless of the failure scenario I believe a timeout in this location would allow configuration of some safety rails against whatever kind of failures could happen.
- Ngôn ngữ chính
- Erlang
- Star
- 1.4k
- Fork
- 458
- Merge trung bình
- 11 giờ 32 phút
- Pull request đã merge (30 ngày)
- 47
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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 benoitc/hackney
-
Support Certifi 2.19.xĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Implement HTTP QUERY (RFC 10008)Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
keepalive timer also closes a freshly dialed pooled connection during the HTTP/1.1 TLS upgradeĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Upgrading to 4.x strategyĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
benoitc/hackney#907 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
benoitc/hackney#596 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của benoitc/hackney
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue severity: low tech-debt
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 75/100
TMHSDigital/subenum#329 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Backblaze/b2-sdk-java#247 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
steelbrain/node-ssh#487 ·