Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7190

Node.Js Server keeps crashing with no error

$
0
0

I am currently taking care of a project for a business that is basically a real time message board used to interact with other employees.

I have taken this over after the basics had already been developed and I am quite new to Node, and developing in general.

Our server just quits unexpectedly at random times with no error. It happens up to once per day, sometimes with very little server load, sometimes with heavy server load.

There is a listener for uncaught exceptions:

    process.on('uncaughtException', function(err) {    // handle the error safely    console.log("Uncaught exception: "+err);    });

and we also print errors to console and a log file, but neither ever shows an error just before it quits!

We are using express and socket.io

Any help would be appreciated.

This is basically the code we have in the server. I am logging all the different processes I can see and I am not getting any error messages at all and it always seems to crash when something different is executing:

    process.on('uncaughtException', function(err) {    // handle the error safely    console.log("Uncaught exception: "+err);    });app.configure(function(){        app.use(express.cookieParser());    // Allow parsing of cookies        app.use(express.json());                            // Support JSON parsng        app.use(express.urlencoded());                      // Support URL encoded params        app.set('view engine', 'ejs');                      // Define view engine as EJS        app.use(express.session({store: sessionStore, secret: sessSecret, key: sessKey}));        app.use(app.router);                                // Use routes        app.use("/public", express.static(__dirname +'/public'));     // Define public directory    });    var server = https.createServer(options, app).listen(app_port, function(){        console.log("Express server listening on port "+ app_port);    });    // Require our routes module    var routesModule = require('./modules/routes.js')(app);    var svc_io  = require("/usr/lib/node_modules/socket.io/index.js")(https);    var dbmodule = require("./modules/db.js");var moment = require('/usr/lib/node_modules/moment/moment.js');    var fs = require('/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js');    var util = require('util');    console.log = function(d){        var time = moment().format('DD-MMM-YYYY HH:mm:ss.SSS');        var log_file = fs.createWriteStream(__dirname +'/debug.log', {flags: 'a'});        var log_stdout = process.stdout;        log_file.write(time +' : '+ util.format(d) +'\n');        log_stdout.write(time +' : '+ util.format(d) +'\n');        log_file.end();    };    var io = svc_io.listen(server);    var socketModule = require('./modules/socket.js')(app, io, sessionStore, cookieParser, sessKey, sessSecret);

Viewing all articles
Browse latest Browse all 7190

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>