Upload requests with Transfer-Encoding: chunked hang forever
Đá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
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- rust
- Lĩnh vực
- api, backend, networking
Hướng nghiên cứu
Bắt đầu tại src/http/request.rs, ở nhánh BodyType::Chunked, và xem lại cách BufReader của Tokio hiện có đọc request body. Tái hiện một lần tải lên chunked hữu hạn qua một kết nối keep-alive, sau đó xác minh rằng dữ liệu chunk, CRLF kết thúc và trailers được tiêu thụ, đồng thời request hoàn tất thay vì chờ EOF.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The hand-written HTTP parser never chunk-decodes request bodies: BodyType::Chunked (src/http/request.rs) reads the raw stream in fixed 1024-byte read_exact blocks until EOF. With a finite payload the client keeps the connection open (keep-alive, no half-close), the final block never fills, and the server blocks forever instead of answering.
Impact
Any client that sends Transfer-Encoding: chunked stalls after its first payload. Concrete case: librespeed/speedtest-cli#122 — librespeed-cli v1.0.13+ uploads at 0.55 Mbps against librespeed-rs 1.4.0:
- The Go client wraps the upload body in a counting
io.TeeReaderwhich hides its length, so it sends chunked. - Server log from a replica of this body handling:
CHUNKED: read 1048837 raw bytes, then EOF/blocked— 1024×1024 payload + 261 bytes of chunk framing; 1048837 is not a multiple of 1024, so the lastread_exact(1024)blocks waiting for 763 more bytes that never come. - Upload rate = one payload / default 15 s duration = 1 MiB / 15 s ≈ 0.55 Mbps.
Same stall applies to curl -H "Transfer-Encoding: chunked" --data-binary @file and any chunked uploader. Content-Length requests (BodyType::Fixed) work fine.
Suggested fix
Parse chunked encoding in the Chunked branch (RFC 9112 §7.1): read the chunk-size line, the chunk data, and the terminating CRLF per chunk; stop at a 0-size chunk and consume the trailer section. Tokio's BufReader (already in use) provides lines() and read_exact for this.
Client-side note
librespeed/speedtest-cli now sends Content-Length for its fixed-size uploads (librespeed/speedtest-cli#143) as a workaround, but fixing chunked handling here makes the server robust for all clients.
- Ngôn ngữ chính
- Rust
- Star
- 254
- Fork
- 40
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không 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 librespeed/speedtest-rust
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
librespeed/speedtest-rust#52 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
librespeed/speedtest-rust#51 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
librespeed/speedtest-rust#36 · 2 bình luận ·
-
Crash when using PostgreSQLĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
librespeed/speedtest-rust#48 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
librespeed/speedtest-rust#43 · 2 bình luận ·
Tất cả issue của librespeed/speedtest-rust
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/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 70/100
nervosnetwork/ckb#5405 ·
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
Maintainer thường phản hồi trong vòng 2 ngày
-
Releases do not move the `latest` Docker tag: the branch `30.12` is taken for the latest release branchCó thể đã có người làm @alexey-milovidov đã nhận hôm nay. Đang mởcomp-ci-infrastructure unexpected behaviour
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
ClickHouse/ClickHouse#134282 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
macOS agent: camera watcher leaks autorelease-pool entries every second (no pool on its thread)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày