`net.Socket({ fd })` can abort the Node.js process when iterating invalid file descriptors
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.3k
- Merge medio
- 4g 2h
- PR unite (30g)
- 283
Descrizione
Version
24.13.1
Platform
Linux KContainer 6.12.86+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.86-1 (2026-05-08) x86_64 x86_64 x86_64 GNU/Linux
Subsystem
net
What steps will reproduce the bug?
Hi,
I found a case where creating net.Socket instances with arbitrary file descriptors can abort the entire Node.js process.
const net = require('net');
let fd = 3;
while (fd < 1000) {
try {
const stream = new net.Socket({
fd: fd,
readable: false,
writable: true
});
stream.on('error', function () {});
stream.write('might crash');
} catch (e) {
// ignore and continue to next fd
console.log('caught')
}
fd += 1;
}
How often does it reproduce? Is there a required condition?
Reproduces consistently on my system.
What is the expected behavior? Why is that the expected behavior?
Invalid or unsupported file descriptors passed to net.Socket({ fd }) should result in ordinary JS exceptions or socket errors, not process abort.
What do you see instead?
Some file descriptors are handled normally and throw JS exceptions that are caught successfully, but eventually Node aborts the process:
root@KContainer:~/git/run/cerebras/node/OPENAI/gpt5.1/filter/batch_3/cross_runtime/temp_deno/3604# node repro.cjs caught caught caught caught
caught
caught
....
caught
caught
caught
caught
caught
caught
caught
caught
Aborted
The abort bypasses JS exception handling entirely.
Additional information
No response
Guida per i contributori
Apri 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.
Direzione di ricerca
Iniziare con la riproduzione JavaScript fornita e il percorso net.Socket({ fd }) su Linux, concentrandosi su come vengono gestiti i descrittori non validi prima di stream.write(). Confermare che l’interruzione sia riproducibile, quindi verificare che i descrittori non validi o non supportati producano eccezioni JavaScript intercettabili o errori del socket senza terminare il processo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, node.js
- Ambito
- networking
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100