Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

node: ../deps/uv/src/uv-common.c:143: uv_err_name: Assertion `0' failed. #63

Closed
sourcewizard opened this issue Jul 7, 2015 · 10 comments

Comments

@sourcewizard
Copy link

Hey everyone, i'm getting this error below. How can i figure out what i can do to fix this?

Thanx!

node: ../deps/uv/src/uv-common.c:143: uv_err_name: Assertion '0' failed.
Aborted
user@machine:/Documents/NodeScripts$ node -v
v0.12.6
user@machine:
/Documents/NodeScripts$ npm -v
2.11.2
user@machine:~/Documents/NodeScripts$`

@trevnorris
Copy link
Contributor

We're going to need a test case to reproduce. Or at minimum a stack trace from a debug build from yourself.

@sourcewizard
Copy link
Author

I can provide you with a code block. How can i get the stack trace?

// ------------------------------------------------------------------------------------------------
// Functions
// ------------------------------------------------------------------------------------------------

function padd(n) {
    if (parseInt(n) < 10) {
        return 0 + n.toString();
    } else {
        return n;
    }
}

// ------------------------------------------------------------------------------------------------
// Global variables
// ------------------------------------------------------------------------------------------------

var fs = require('fs');
var chokidar = require('chokidar');
var mysql = require('mysql');
var xml2js = require('xml2js');
var io = require('socket.io');

var folder = '/mnt/rhotex320/HotFolders/PrintEvents';

var watcher = chokidar.watch(folder, {
  usePolling: true,
  useFsEvents: false,
  depth: 1,
  interval: 1,
  atomic: false
});

var parser = new xml2js.Parser({
    explicitArray: false,
    trim: true,
    mergeAttrs: true
});

var date = new Date();
var year = date.getFullYear();
var month = padd(date.getMonth() + 1);      // From 0 to 11
var day = padd(date.getDate())              // From 1 to 31
var hours = padd(date.getHours());          // From 0 to 23
var minutes = padd(date.getMinutes());      // From 0 to 59
var seconds = padd(date.getSeconds());      // From 0 to 59

var dateTime = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;

// MySQL connection
var pool = mysql.createPool({
    host: 'XX.XX.XX.XX',
    user: 'myser',
    database: 'mydb',
    password: 'mypassword'
});

// Socket.io
var socket = require('socket.io-client')('http://mydomain:3000');

// ------------------------------------------------------------------------------------------------
// Initialize Watcher
// ------------------------------------------------------------------------------------------------

watcher.on('ready', function() {
    watcher.on('add', function(path, stats) {   
        // Read the XML
        fs.readFile(path, function(err, data) {     
            // Parse the XML
            parser.parseString(data, function (err, result) {
                var job_state = path.split('_').slice(-1).pop().split('.')[0];
                if (job_state == 'printing' || job_state == 'done') {
                    pool.getConnection(function(err, connection) {

                        var resultJobState = result.sequence.sequence_entry.state;
                        var resultJobName = result.sequence.sequence_entry.job.job_name + '%';      
                        var resultPrintsDone = result.sequence.sequence_entry.job.number_prints_done;
                        var resultNrToPrint = result.sequence.sequence_entry.job.number_to_print;
                        var statusCode = (resultJobState == 'Done') ? 2 : 1;                        

                        if (parseInt(resultPrintsDone) === parseInt(resultNrToPrint)) {                     

                            // Here we want to update the status to done!
                            var q1a = connection.query('SELECT * FROM `nests` WHERE `job_name` LIKE ? AND `job_state` != ?',[ resultJobName, 'Done' ], function(error, results, fields) {                                                               
                                if (typeof(results[0]) == 'object') {
                                    var q1b = connection.query('UPDATE `nests` SET `printed_item` = ?, `nr_of_prints` = ?, `job_state` = ?, `statuscode` = ? WHERE `job_name` LIKE ?',
                                        [ resultPrintsDone, resultNrToPrint, resultJobState, statusCode, resultJobName ], function(err, result) {
                                        socket.emit(
                                            'Rhotex 320 - Job State', 
                                            [{
                                                path: path,
                                                job_name: resultJobName.split('%')[0].trim(),
                                                affected_rows: result.affectedRow,
                                                job_state: resultJobState
                                            }]
                                        );
                                    });
                                };
                            });

                        } else {

                            // Here we want to update the status to printing!
                            var q1a = connection.query('SELECT * FROM `nests` WHERE `job_name` LIKE ?',[ resultJobName ], function(error, results, fields) {                                                                
                                if (typeof(results[0]) == 'object') {
                                    var q1b = connection.query('UPDATE `nests` SET `printed_item` = ?, `nr_of_prints` = ?, `job_state` = ?, `statuscode` = ? WHERE `job_name` LIKE ?',
                                        [ resultPrintsDone, resultNrToPrint, resultJobState, statusCode, resultJobName ], function(err, result) {
                                        socket.emit(
                                            'Rhotex 320 - Job State', 
                                            [{
                                                nestcode: results[0].nestcode,
                                                path: path,
                                                job_name: resultJobName.split('%')[0].trim(),
                                                affected_rows: result.affectedRow,
                                                job_state: resultJobState
                                            }]
                                        );
                                    });
                                };
                            })                          

                        }
                    });
                }
            });
        });         
    });
});

// ------------------------------------------------------------------------------------------------```

@trevnorris
Copy link
Contributor

The best way to get a stack trace is to run the script using the debug build. Though those are not available for download so it would need to be built for your system.

If that isn't an option then if you can provide me a more minimal test case (preferably one without any external dependencies) then I will be able to debug the issue for you.

Also, was there a previous version of node where this didn't happen? If so, what was it?

@sourcewizard
Copy link
Author

Well what i can say is that i compiled and installed it from scratch. I downloaded the source from the official site. The operating system i used it on was an old linux distro running Debian 6.0.

Previously i ran v0.12.3 then i got the same error only on line 75.

@trevnorris
Copy link
Contributor

Thanks much. When building you want to run ./configure --debug to produce the debug build. Then in the folder there will be node_g which is the debug executable. If you can reproduce the issue with this then we'll have a lot more information to go on.

@sourcewizard
Copy link
Author

Thanx! I'll work on it today.

@sourcewizard
Copy link
Author

Trevor,

You i wil close this for now. Someone else in my team working on the problem right now.
Thanks for your help.

@domarmstrong
Copy link

And did they resolve the issue? I am getting the same error

@sourcewizard
Copy link
Author

Hey there,

Well it doesn't occur anymore because we rewrote the scripts. It seems to appear only when there is some kind of memory leak on the system. But to answer your question more clearly no they did not resolve it, they just rewrote the script and the error does not occur anymore.

@domarmstrong
Copy link

Well I have resolved my issue. Turns out my VPS had run out of disk space.. Nice and obscure error message didn't help too much.

bnoordhuis referenced this issue in bnoordhuis/libuv Jul 30, 2015
Make uv_err_name() and uv_strerror() return a dynamically allocated
string when the error code is not recognized.

It leaks a few bytes of memory but that can't be helped.  Asserting
and aborting is, in my opinion, much less helpful.

Fixes: nodejs/node#63
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants