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

Opening more than 3 serial ports #1299

Closed
espitall opened this issue Aug 11, 2017 · 4 comments
Closed

Opening more than 3 serial ports #1299

espitall opened this issue Aug 11, 2017 · 4 comments

Comments

@espitall
Copy link

  • SerialPort Version: 5.0.0

  • NodeJS Version: electron 1.6.10 (node 7.4.0)

  • Operating System and Hardware Platform: Windows 7 64bits

  • Have you checked the right version of the api docs?: yes

  • Are you having trouble installing and you checked the Installation Special Cases docs? no

  • Are you using Electron and have you checked the Electron Docs?: yes

Summary of Problem

Node-serialport can not open more than 3 serial ports. I am not familiar with node-serialport source code but it seems to start one libuv thread for each opened serial port. Unfortunately the default thread number is pretty low (4) so when 4 serial ports are opened simultaneously it can not respond to any other command (list, close, etc.).

Steps and Code to Reproduce the Issue

  • Open 4 serial ports
  • Request serialport list => callback never called
@espitall
Copy link
Author

More informations :

  • setting UV_THREADPOOL_SIZE to an higher number allows more serial ports to be opened

  • I have noticed a very high CPU usage even with only one serial port (each port opened seems to use 100% of one core of my CPU) and I have made an ugly hack to fix this by changing
    commTimeouts.ReadIntervalTimeout = MAXDWORD;
    to
    commTimeouts.ReadIntervalTimeout = 10;
    It seems that it also fix the "4 serial ports opened" issue with even with UV_THREADPOOL_SIZE set to 4 (default value).

@espitall
Copy link
Author

Just found that my issue report is a duplicate #1221. Sorry for the noise...
Please consider adding a note on the README file about this limitation on windows platform.

Can you tell me if I can keep by little hack ('commTimeouts.ReadIntervalTimeout = 10;' -- which also address the high CPU usage) or does it will cause others issues ?

@reconbot
Copy link
Member

I don't know if it would cause issues or not. I'd guess not. You can tell us for sure. =)

Added the note!

@reconbot
Copy link
Member

I also added a note saying we really do need help to close #1221 it's a bit beyond my abilities with windows c++. I've put quite a few hours into it but I have a hard time debugging.

@lock lock bot locked and limited conversation to collaborators Feb 8, 2018
reconbot added a commit that referenced this issue Jul 24, 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