Node.js server fails to bind on ipv6 if ipv4 is not available
Chưa có ai nhận issue này.
- 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
v24.18.1
Platform
Linux ssh2 6.18.43-alwaysdata #1 SMP PREEMPT_DYNAMIC Fri Aug 7 07:39:43 UTC 2026 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
- Run a HTTP server (code below)
- Try to connect to it (via e.g. python, netcat, a browser etc.)
code:
const http = require("http");
const server = http.createServer((req,res)=>{
res.writeHead(200, "Content-Type", "text/plain");
res.write("ok");
res.end();
});
server.listen({ port: 8300 }, ()=> {
console.log("Server is running");
});
I also tried all the following:
server.listen({ port: 8300, host: "::" }, ()=> {
console.log("Server is running");
});
server.listen({ port: 8300, host: "::", ipv6Only: true }, ()=> {
console.log("Server is running");
});
server.listen({ port: 8300, host: "", ipv6Only: true }, ()=> {
console.log("Server is running");
});
server.listen({ port: 8300, host: "0.0.0.0", ipv6Only: true }, ()=> {
console.log("Server is running");
});
server.listen({ port: 8300, host: "::1", ipv6Only: true }, ()=> {
console.log("Server is running");
});
server.listen({ port: 8300, host: "" }, ()=> {
console.log("Server is running");
});
server.listen(8300, "::", ()=> {
console.log("Server is running");
});
server.listen(8300, "", ()=> {
console.log("Server is running");
});
// maybe even more i forgot
How often does it reproduce? Is there a required condition?
TCPv4 must not be available on the OS.
For example, netstat -lntp must say this:
netstat: no support for `AF INET (tcp)' on this system.
netstat -lntp6 must not say that, however - instead, it should succeed:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
What is the expected behavior? Why is that the expected behavior?
The server should be accessible
What do you see instead?
No error is thrown or logged, however, I cannot connect to the server in any imaginable way
Additional information
edit: offensive comment removed by moderator
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 tái hiện vấn đề với HTTP server được cung cấp và các biến thể của listen trên Linux không hỗ trợ TCPv4, sau đó truy vết đường dẫn mạng của server.listen. Xác nhận bản sửa bằng cách kiểm tra rằng IPv6-only server có thể truy cập được và hành vi listen hiện có vẫn đúng trong các bài kiểm thử mạng liên quan.
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
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100