Giter VIP home page Giter VIP logo

Comments (10)

trevnorris avatar trevnorris commented on May 21, 2024

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

from node-convergence-archive.

sourcewizard avatar sourcewizard commented on May 21, 2024

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
                                            }]
                                        );
                                    });
                                };
                            })                          

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

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

from node-convergence-archive.

trevnorris avatar trevnorris commented on May 21, 2024

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?

from node-convergence-archive.

sourcewizard avatar sourcewizard commented on May 21, 2024

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.

from node-convergence-archive.

trevnorris avatar trevnorris commented on May 21, 2024

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.

from node-convergence-archive.

sourcewizard avatar sourcewizard commented on May 21, 2024

Thanx! I'll work on it today.

from node-convergence-archive.

sourcewizard avatar sourcewizard commented on May 21, 2024

Trevor,

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

from node-convergence-archive.

domarmstrong avatar domarmstrong commented on May 21, 2024

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

from node-convergence-archive.

sourcewizard avatar sourcewizard commented on May 21, 2024

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.

from node-convergence-archive.

domarmstrong avatar domarmstrong commented on May 21, 2024

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.

from node-convergence-archive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.