deno_std
deno_std copied to clipboard
node: net servers are swallowing errors and hanging the process
Describe the bug If an exception is thrown from the handler of a running server, the process hangs and no error is reported. If the server is closed prior to throwing the exception, the process terminates, but the error is not displayed.
Steps to Reproduce
Run the following script. The server.close()
call can optionally be uncommented.
import net from "./node/net.ts";
const server = net.createServer((socket) => {
// server.close();
throw new Error("bye");
}).listen(0, "127.0.0.1", () => {
const client = net.createConnection(server.address().port, "127.0.0.1")
client.on("connect", () => {
client.end();
});
});
Expected behavior The process should exit with a stack trace.
Environment
- OS: macOS
- deno version: 1.25.0
- std version: 0.153.0
Maybe related: https://github.com/denoland/deno/issues/15869