nodejs / nodejs/node

inspector: response.setEncoding() causes response.on('data') never triggered when --experimental-network-inspection is enabled

オープン
#64,494 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

inspector
主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

Version

v24.17.0

Platform
Windows 11 x64 (10.0.26200)
Subsystem

No response

What steps will reproduce the bug?

When experimental network inspection is enabled, calling response.setEncoding() on an http.IncomingMessage causes Node Inspector to throw exception.
The exception interrupts normal stream processing. response.on("data") callback never triggered.

const http = require('http');

http.get("http://example.com", (response) => {
    response.setEncoding("utf8");

    response.on("data", chunk => {
        console.log(chunk);
    });

    response.on("end", () => {
        console.log("end");
        process.exit(0);
    });

});

Run node --inspect --experimental-network-inspection main.js then open any inspector frontend (Chrome DevTools).

How often does it reproduce? Is there a required condition?

When network inspection feature enabled.

What is the expected behavior? Why is that the expected behavior?

Network inspection should continue to work regardless of whether response.setEncoding() is used.

What do you see instead?

Nodejs throws exception and interrupts normal stream processing. response.on("data") callback never triggered.

Additional information

VSCode extension debugging host enables this feature and breaks my extension development. Waste 2 days to find out why every http request got empty response.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、提供されている HTTP の例を node --inspect --experimental-network-inspection main.js と inspector frontend で実行し、次に response.setEncoding() によって発生する例外を捕捉します。ストリームを中断するネットワークインスペクションの処理を追跡します。dataend のコールバックがエンコーディングを有効にした状態で正常に実行されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js
領域
backend, devtools
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。