node.js socket.io script getting killed by SIGSEGV after 1-2 days

301 views
Skip to first unread message

mps

unread,
May 22, 2014, 6:13:51 AM5/22/14
to nod...@googlegroups.com
I am running my node.js server by forever and my script gets killed in 1-2 days and i get this error in the log file:

    error: Forever detected script was killed by signal: SIGSEGV

Now i have many functions in my node.js script. Upon writing a console.log at  the beginning of each function i ended up getting this in the log:

    info: transport end (undefined)
    debug: set close timeout for client CbU1mvlYaIvDWHB4ChQa
    debug: cleared close timeout for client CbU1mvlYaIvDWHB4ChQa
    disconnection function
    debug: discarding transport
    debug: clearing poll timeout
    debug: client authorized
    info: handshake authorized 2O3m1B3dGWFOJ4W9ChQc
    error: Forever detected script was killed by signal: SIGSEGV

the log makes it seem as if either the connect or the disconnect function has a problem, but as the script seg faults after 2 days of running and over 10000 connections/disconnections i think that that might not be really the problem.

Here are my connection and disconnection functions. i also connect to my pgsql database via node-dbi:


    var DBWrapper = require('node-dbi').DBWrapper; 
    var DBExpr = require('node-dbi').DBExpr; 
    var dbConnectionConfig = { host: 'localhost', user: 'user', password:   'pass', database: 'dbname' };
    dbWrapper = new DBWrapper( "pg", dbConnectionConfig );
    dbWrapper.connect();

    io.sockets.on('connection', function(socket) {
  
  
      console.log("socket connection");

    socket.on('set username', function(userName) {
    var milliseconds = (new Date).getTime();
    var data = { socketid: socket.id, time: milliseconds };
    dbWrapper.insert('all_sockets', data , function(err) {
    });

    });

    socket.on('disconnect', function() {
      
      console.log("disconnection function");
      dbWrapper.remove('all_sockets', [['socketid=?', socket.id]] , function(err) {} );
     });

    });


where could the segment fault be coming from?

Aria Stewart

unread,
May 22, 2014, 11:49:16 AM5/22/14
to nod...@googlegroups.com

On May 22, 02014, at 6:13, mps <charaka...@gmail.com> wrote:

> I am running my node.js server by forever and my script gets killed in 1-2 days and i get this error in the log file:
>
> error: Forever detected script was killed by signal: SIGSEGV
>
[snip]

> where could the segment fault be coming from?

Best bet is to configure your server to dump core files. (ulimit and some system parameters control whether or not you get a dump)

Given the core file, it should be possible to look at it with a debugger and see where the crash was and what was going on.

Generally this is within C/C++ dependencies (or, I hope not, within V8). There’s also the slim chance that your machine has bad RAM or something equally evil, but that’s a long shot.

Aria

signature.asc

mps

unread,
May 22, 2014, 2:53:10 PM5/22/14
to nod...@googlegroups.com
Any help on how i can generated the core dump file?
Reply all
Reply to author
Forward
0 new messages