You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On linux, when you open() and close() the serial port connection, the file descriptor to the device (e.g. to /dev/ttyUSB0) will not be closed properly.
I've written a simple application that will open and close the connection to the serial port every second.
When you watch the file descriptors with 'lsof -c node' you will see that on every call to open() a new file descriptor is opened that will not be closed on close();
Used node version: 0.10.x
Used serialport module: 1.7.4
Example application to test the issue (it will open an close the serialport every second):
var serialport = require('serialport');
var portConnection = new serialport.SerialPort('/dev/ttyUSB0',
{
baudrate: 9600
},
false
);
var openClosePortEverySecond = function () {
portConnection.open(function (error) {
if (typeof error !== 'undefined') {
console.log('failed to open serialport');
console.log(error);
} else {
console.log('serialport opened');
portConnection.close(function (error) {
if (typeof error !== 'undefined') {
console.log('failed to close serialport');
console.log(error);
} else {
console.log('serialport closed');
setTimeout(function() {
openClosePortEverySecond();
},1000);
}
});
}
});
};
openClosePortEverySecond() ;
process.stdin.resume();
You can watch the open file descriptors with: watch -n1 "lsof -c node | wc -l"
The text was updated successfully, but these errors were encountered:
I'm going to close this as we've confirmed this bug is fixed. Please reopen or make a new issue if you have more issues! Thanks for reporting it and tracking down the issue!
On linux, when you open() and close() the serial port connection, the file descriptor to the device (e.g. to /dev/ttyUSB0) will not be closed properly.
I've written a simple application that will open and close the connection to the serial port every second.
When you watch the file descriptors with 'lsof -c node' you will see that on every call to open() a new file descriptor is opened that will not be closed on close();
Used node version: 0.10.x
Used serialport module: 1.7.4
Example application to test the issue (it will open an close the serialport every second):
You can watch the open file descriptors with: watch -n1 "lsof -c node | wc -l"
The text was updated successfully, but these errors were encountered: