Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node exit after new SerialPort() #58

Closed
nosteve opened this issue Jul 24, 2012 · 2 comments
Closed

Node exit after new SerialPort() #58

nosteve opened this issue Jul 24, 2012 · 2 comments

Comments

@nosteve
Copy link

nosteve commented Jul 24, 2012

A bit stumped, node script is causing exit without error on Windows, even when trying to capture unhandled exceptions using the "process.on" trick. Narrowed this behavior down to when I create a new SerialPort object.

System is Windows 7 Pro x64, using latest Node 0.8.3. Built libs using VS Express 2010.

Script works on Mac using same libraries without issue. Removing the new SerialPort() line resolves the issue, script works fine otherwise.

Here is sample program to repro and debug info. I'm not sure where else to look - maybe it's a bad compile, or some kind of 64-bit issue? It seems like the OS might be killing it but I don't see anything in Event Viewer (maybe I need to turn on more options in there?) Any troubleshooting help appreciated.

repro:

var connect = require('connect');
var SerialPort = require('serialport').SerialPort;
var argv = process.argv;

process.on('uncaughtException', function(err) {
console.log(err);
});

var serialPort = new SerialPort();

connect.createServer(
connect.static(__dirname)
).listen(argv[2] || 8082);

debug:

C:\Users\Steve\src\glomo>node debug wtf.js
< debugger listening on port 5858
connecting... ok
break in C:\Users\Steve\src\glomo\wtf.js:1
1 var connect = require('connect');
2 var SerialPort = require('serialport').SerialPort;
3 var argv = process.argv;
debug> n
break in C:\Users\Steve\src\glomo\wtf.js:2
1 var connect = require('connect');
2 var SerialPort = require('serialport').SerialPort;
3 var argv = process.argv;
4
debug> n
break in C:\Users\Steve\src\glomo\wtf.js:2
1 var connect = require('connect');
2 var SerialPort = require('serialport').SerialPort;
3 var argv = process.argv;
4
debug> n
break in C:\Users\Steve\src\glomo\wtf.js:3
1 var connect = require('connect');
2 var SerialPort = require('serialport').SerialPort;
3 var argv = process.argv;
4
5 process.on('uncaughtException', function(err) {
debug> n
break in C:\Users\Steve\src\glomo\wtf.js:5
3 var argv = process.argv;
4
5 process.on('uncaughtException', function(err) {
6 console.log(err);
7 });
debug> n
break in C:\Users\Steve\src\glomo\wtf.js:9
7 });
8
9 var serialPort = new SerialPort();
10
11 connect.createServer(
debug> n
break in C:\Users\Steve\src\glomo\wtf.js:12
10
11 connect.createServer(
12 connect.static(__dirname)
13 ).listen(argv[2] || 8082);
14
debug> n
break in C:\Users\Steve\src\glomo\wtf.js:11
9 var serialPort = new SerialPort();
10
11 connect.createServer(
12 connect.static(__dirname)
13 ).listen(argv[2] || 8082);
debug> n
break in C:\Users\Steve\src\glomo\wtf.js:16
14
15
16 });
debug> n
break in module.js:450
448 var args = [self.exports, require, self, filename, dirname];
449 return compiledWrapper.apply(self.exports, args);
450 };
451
452
debug> n
break in module.js:468
466 var content = NativeModule.require('fs').readFileSync(filename, 'utf8');
467 module._compile(stripBOM(content), filename);
468 };
469
470
debug> n
break in module.js:357
355 if (!Module._extensions[extension]) extension = '.js';
356 Module._extensions[extension](this, filename);
357 this.loaded = true;
358 };
359
debug> n
break in module.js:358
356 Module._extensions[extension](this, filename);
357 this.loaded = true;
358 };
359
360
debug> n
break in module.js:313
311 try {
312 module.load(filename);
313 hadException = false;
314 } finally {
315 if (hadException) {
debug> n
break in module.js:315
313 hadException = false;
314 } finally {
315 if (hadException) {
316 delete Module._cache[filename];
317 }
debug> n
break in module.js:320
318 }
319
320 return module.exports;
321 };
322
debug> n
break in module.js:321
319
320 return module.exports;
321 };
322
323 Module._resolveFilename = function(request, parent) {
debug> n
break in module.js:493
491 // Load the main module--the command line argument.
492 Module._load(process.argv[1], null, true);
493 };
494
495 Module._initPaths = function() {
debug> n
break in timers.js:106
104 process.emit('uncaughtException', e);
105 }
106 if (first.domain) first.domain.exit();
107 }
108 }
debug> n
break in timers.js:78
76
77 var first;
78 while (first = L.peek(list)) {
79 var diff = now - first._idleStart;
80 if (diff + 1 < msecs) {
debug> n
break in timers.js:110
108 }
109
110 debug(msecs + ' list empty');
111 assert(L.isEmpty(list));
112 list.close();
debug> n
break in timers.js:111
109
110 debug(msecs + ' list empty');
111 assert(L.isEmpty(list));
112 list.close();
113 delete lists[msecs];
debug> n
break in timers.js:112
110 debug(msecs + ' list empty');
111 assert(L.isEmpty(list));
112 list.close();
113 delete lists[msecs];
114 };
debug> n
break in timers.js:114
112 list.close();
113 delete lists[msecs];
114 };
115 }
116
debug> n
program terminated
debug>

@joeferner
Copy link
Contributor

duplicate of issue #59

@nosteve
Copy link
Author

nosteve commented Jul 24, 2012

ack sry, meant to edit not create new...

@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants