node:internal/inspector/network_http: `TypeError: Missing dataLength` in event when response uses `setEncoding()`
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, node.js
- Ambito
- devtools
Direzione di ricerca
Inizia da lib/internal/inspector/network_http.js e segui il listener dei dati che invia i chunk della risposta all'inspector. Riproduci il problema con un processo collegato all'inspector che esegue una https.request e chiama response.setEncoding('utf8'); il lavoro è completato quando la richiesta termina senza l'errore Missing dataLength né una risposta interrotta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Node.js version: 24.21.0 (as bundled in Electron 43.7.3 / VS Code 1.140.0)
Platform: macOS arm64 (likely affects all platforms)
Description
When the V8 inspector is attached and an IncomingMessage response has had setEncoding() called on it, the inspector's data listener in lib/internal/inspector/network_http.js throws TypeError: Missing dataLength in event. This throw propagates through EventEmitter.emit uncaug and causes Node's stream machinery to call destroy(err) on the socket. The caller receives reason: aborted with no indication of the real cause.
Root cause
network_http.js passes chunk.byteLength as dataLength to the C++ NetworkAgent::dataReceived handler. When response.setEncoding('utf8') has been called, Node emits string chunks instead of Buffer
chunks — strings have .length but not .byteLength, so chunk.byteLength is undefined. The C++ ObjectGetInt validation fails and throws.
Suggested fix
// lib/internal/inspector/network_http.js
dataLength: typeof chunk === 'string' ? Buffer.byteLength(chunk) : chunk.byteLength,
Reproduction
Attach the V8 inspector (e.g. VS Code F5 debugger) to a Node process that makes an https.request call and calls response.setEncoding('utf8') in the response handler. The request will abort with reason: aborted instead of completing successfully. The same code works without the debugger attached.
Example
const data = [];
response.setEncoding('utf8')
response.on('data', function (chunk) {
data.push(chunk);
});
response.on('end', function () {
resolve(data.join(''));
});
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 39k
- Merge medio
- 3g 22h
- PR unite (30g)
- 245
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nodejs/node
-
[Docs] `process.loadEnvFile()` does not document behaviour when variables already existForse già presa @Sepandard l’ha presa 12 giorni fa. Apertadoc
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
Stream.prototype.forEach will block in first promise in queue before read more chunkForse già presa @mmustafasenoglu l’ha presa 13 giorni fa. Apertadoc
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
build
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
nodejs/node#66076 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
`TextEncoder.encodeInto()` underfills the destination for some non-ASCII textForse già presa @XadillaX l’ha presa 27 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
nodejs/node#65994 · 2 commenti · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
[`util.styleText`] Allow `text` param to be any scalar value (ex. `number`, `bool` etc additionaly to `string`) which will be casted internally to `string`Forse già presa @SparshGarg999 l’ha presa 88 giorni fa. Apertafeature request
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
nodejs/node#63841 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Remove: Fox Deportes SDApertacheck:passed feeds:remove
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
iptv-org/database#37176 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 9 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
hawk-digital-environments/HAWKI#443 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
feedback simulation workshop
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
githubnext/gh-aw-workshop#4370 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
AltimateAI/vscode-dbt-power-user#2089 ·