Node.js server fails to bind on ipv6 if ipv4 is not available
オープン
まだ誰も着手していません。
http
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、TCPv4 をサポートしていない Linux 上で、提供された HTTP サーバーと listen の各バリアントを使って問題を再現し、その後 server.listen のネットワークパスを追跡します。IPv6-only サーバーに到達できるようになること、および関連するネットワークテストで既存の listen の動作が引き続き正しいことを確認して、修正を検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- backend, networking
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100