nodejs / nodejs/node

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

Đang mở
#64,494 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

inspector
Ngôn ngữ chính
JavaScript
Star
122k
Fork
37.4k
Merge trung bình
4 ngày 3 giờ
Pull request đã merge (30 ngày)
272

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. 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 ví dụ HTTP được cung cấp với node --inspect --experimental-network-inspection main.js và một frontend inspector, sau đó ghi lại exception được kích hoạt bởi response.setEncoding(). Truy vết phần xử lý network inspection làm gián đoạn stream; hoàn tất khi các callback dataend chạy bình thường với encoding được bật.

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, devtools
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 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
52/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.