Closed finim closed 8 years ago
Update: it seems that this issue is only in the latest version(s), i've tested 3 versions: 1.7.4 : leaking 1.7.1 : not leaking 1.6.2 : not leaking
I got the same issue... I'm using node v0.12.4 and serialport: 1.7.4. The kernel version is 3.16.0-40-generic
.
I have tried your example code with false
and next true
values on portConnection
, both had the issue.
I got the issue ... serialport: 1.7.4.
handle is open 2 times in serialport_unix.cpp
1. void EIO_Open(uv_work_t* req) { ... int fd = open(data->path, flags);
if(-1 == setup(fd, data)){ ...
2. int setup(int fd, OpenBaton *data) { ... fd = open(data->path, flags)
We fixed a ton of bugs in our latest beta specifically ones addressing this issue. https://github.com/voodootikigod/node-serialport/issues/733 Please try it out serialport@2.0.7-beta4
and report back!
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"