Error: read ECONNRESET
- Version: v15.3.0
- Platform: Darwin
- Subsystem: MacOS 11.0.1
What steps will reproduce the bug?
The code That I created.
const http2 = require('http2');
const fs = require('fs');
const http2Server = http2.createSecureServer({
key: fs.readFileSync('localhost-privkey.pem'),
cert: fs.readFileSync('localhost-cert.pem')
});
http2Server.on('error', (err) => console.error(err));
http2Server.on('request', (req, res)=>{
console.log(req.httpVersion);
console.log(req.headers);
res.end('hello, word.')
});
http2Server.listen(1443, ()=> {
console.log('http2 started 1443')
});
I use 'wget' to send the request.
wget --no-check-certificate https://localhost:1443
results:
node:events:353
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:213:20)
Emitted 'error' event on TLSSocket instance at:
at emitErrorNT (node:internal/streams/destroy:188:8)
at emitErrorCloseNT (node:internal/streams/destroy:153:3)
at processTicksAndRejections (node:internal/process/task_queues:80:21) {
errno: -54,
code: 'ECONNRESET',
syscall: 'read'
}
@nodejs/http2
The error isn't coming from the server it's coming from the request or response being closed early, you should probably add an error handler on the request/response streams as well.
Anyway this is not a bug from what I can tell - so I'll move to nodejs/help
The error isn't coming from the server it's coming from the request or response being closed early, you should probably add an error handler on the request/response streams as well.
I use nodejs for start http2 server, but at receiving a incorrect http2 protocol request, throws an error and terminates the process, which is so serious that I personally think this error should have occurred in the Http2Server.on (' error ') event.
which is so serious that I personally think this error should have occurred in the Http2Server.on (' error ') event.
But the error is part of the request stream and not the server :]
Node.js crashes on uncaught exceptions - event emitters in Node typically don't "propagate" automatically afaik.
It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.
It seems there has been no activity on this issue for a while, and it is being closed. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.