Reputation: 3089
It's a super simple express app. After some time WITH NOT REQUESTS, just sitting idle this error will happen:
Example app listening on port 80!
events.js:160
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at exports._errnoException (util.js:1022:11)
at TCP.onread (net.js:572:26)
For reference here is the code
"use strict"
var express = require('express');
var app = express();
app.get('/', function(req, res) {
res.end('hello')
})
app.listen(80, function () {
console.log('Example app listening on port 80!')
})
Upvotes: 3
Views: 1777
Reputation: 631
socket receive a 'error' event,we should use 'error' event listener, otherwise it will propagate and crash you process.
var server = http.createServer(function(request, response){ ... ... });
server.on('error', function(err) { ... ... });
server.on('listening', function(err) { ... ... });
Upvotes: 1