Http client sometimes returns EPIPE when server does not read request body
Đang mở
Chưa có ai nhận issue này.
http
- Ngôn ngữ chính
- JavaScript
- Star
- 122k
- Fork
- 37.3k
- Merge trung bình
- 4 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 283
Mô tả
- Version: v15.12.0
- Platform: Darwin Kernel Version 20.3.0
What steps will reproduce the bug?
let http = require("http");
let server = http.createServer(async function(req, res)
{
res.end("ok");
});
(async function()
{
await new Promise(resolve => server.listen(resolve));
let buf = Buffer.alloc(50000000);
for(let i = 0; ; i++)
{
let req = http.request({ port: server.address().port, method: "post" }).end(buf);
let res = await new Promise((resolve, reject) => req.on("response", resolve).on("error", reject));
let str = "";
for await (let chunk of res) str += chunk;
console.log(i, "client received:", str);
}
}());
How often does it reproduce? Is there a required condition?
Sometimes. It can take a few thousands of iterations or more.
What is the expected behavior?
No EPIPE.
What do you see instead?
85784 client received: ok
node:internal/process/promises:245
triggerUncaughtException(err, true /* fromPromise */);
^
Error: write EPIPE
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
Additional information
It does not happen on linux (after more than million iterations).
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.
Hướng nghiên cứu
Bắt đầu bằng cách chạy bản tái hiện HTTP client/server được cung cấp trên Darwin và so sánh hành vi của nó với Linux. Payload không nêu tệp nguồn hoặc test nào, vì vậy hãy lần theo đường dẫn ghi request body của HTTP client liên quan đến EPIPE và xác định một regression test tập trung. Hoàn tất khi bản tái hiện không còn tạo ra EPIPE trong khi server không đọc request body.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend, networking
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100