-
-
Notifications
You must be signed in to change notification settings - Fork 998
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
multiple ports #37
Comments
I'm seeing the same issue. Up to 4 ports as well, then after that I start seeing strange issues like connections hanging. This seems like a serious bug in node-serialport - has this been looked into at all? |
Given that the normal use case for serialport port is opening a single port, deeming this a "serious bug" is a bit dramatic. Can I get a bit of insight from both or one of you as to why you are opening multiple serialports in single process? Might help me with context as to what is going on. I have looked into this, but can't see anything glaringly obvious as to what is the matter. If you can't talk publicly about it, please contact me directly. |
Sorry, didn't mean to sound dramatic - I'm using node-serialport for a project in a hackathon and I haven't had a lot of sleep. You're right that this is a unusual use case - we're controlling a group of Bluetooth serial devices using node. The reason I was concerned was just that I didn't see any mention of a hardcoded limit anywhere, and I thought it might be indicative of a more serious problem. I know for sure that more of these serial ports CAN be opened, since the workaround we used was to use several child processes to handle the serial ports. Haven't had a chance to check out the test case that jewepasch posted, but I have enough serial devices right now to do so, so I can update you on that soon enough. |
No worries on the drama - fully appreciate the situation and thank you for the details. The child process also supports more isolated control, so I would recommend that BUT that said, I want to track down the issue. I am a bit strapped for time right now, but should be able to debug it soon. Thanks for the details. Chris Williams @voodootikigod (http://twitter.com/voodootikigod) | GitHub (http://github.com/voodootikigod) The things I make that you should check out: Help me end the negativity on the internet, share this (http://jsconf.eu/2011/an_end_to_negativity.html). On Sunday, August 19, 2012 at 7:06 PM, Rob O'Dwyer wrote:
|
Same issue. I'm seeing a limit of 3 ports. Is there a solution, temporary or otherwise? |
I've scanned quickly through the javascript, linux, and windows code. I see nothing in these codebases which jumps out at me as limiting or slowing down when multiple serial ports are used. However, assuming Linux is the OS, I have found known issues in the Serial-HOWTO guide for Linux. Among the notes are: Number of Serial Ports Supported
Extremely Slow: Text appears on the screen slowly after long delays
I'd suggest that it is highly likely an OS or driver or device issue rather than an issue with this library. I'd recommend combing through the Serial-HOWTO article to see if you can find a solution there. |
@JayBeavers It's been a while since I touched the code related to this, but I was seeing this issue on both Linux and OS X. I also have a hard time believing it's a kernel issue since I was able to work around the limit by simply forking a child process for each port. I'll dig up the app I was working on and test it again. Maybe @jewepasch and I were running into the same issue with different causes, since I was using Bluetooth serial ports (is there an OS limit on those?). |
Fair enough, most of this doc was talking about the old 16550 days. Perhaps we're seeing issues at the device driver level or the bluetooth communications stack level. @robbles, did you try reproducing the same environment using a different programming platform, e.g. talking to the serial ports via C directly? |
I did some testing of this using socat to create virtual serial ports. I wrote a simple async python script that reads from 5 different serial ports (basically the equivalent of the original posted by jewepasch). It seems to work fine, but the node-serialport one shows ioctl errors, gets mangled data from the serial port and seems to buffer after the first line of data is received. https://gist.github.com/robbles/6042075 If you want to try it out, just run the shell script and then run either the python or node script. The serialports are created as linked pairs of |
Awesome test case thanks will use it to debug! On Friday, July 19, 2013, robbles wrote:
Chris Williams @voodootikigod http://twitter.com/voodootikigod | The things I make that you should check out: Help me end the negativity on the internet, share |
@robbles, so if I'm following correctly, if I start writing bytes into /tmp/ttysB1, I will receive data on /tmp/ttysA1 and vice versa? I started a test harness using mocha & chai under ~/test/*, but it requires an echo programmed Arduino to work. Do you think you could get this test to pass using socat instead? This test relies upon list() and pnpids, so it would either need to be modified to open the port directly or you would have to figure out how socat works with list() and modify the port filtering in the test. To run test test, simply execute 'npm test'. |
@JayBeavers Yes, that's right. I left out that part of the test, sorry. You can just do Sure, I'll give it a try. It doesn't look like the virtual ports show up the results from list(), so I'll probably just change it to search for the ones created by socat. |
Just want to join with same problem. I have application which communicates in parallel with 4 USB serial ports. It works correctly on Windows, it hangs on Raspberry Pi. When I am connecting one by one so not 2 ports communicates in parallel it works correctly also on Raspberry Pi. All latest node.js 0.10.21 and serial port 1.2.3. Will probably need to use workaround with child processes :-( |
Can you provide example code? On Monday, November 4, 2013, Boris Letocha wrote:
Chris Williams @voodootikigod http://twitter.com/voodootikigod | The things I make that you should check out: |
It is relatively nontrivial code (https://gist.github.com/Bobris/7325335) and you need that HW to be able to reproduce. On the other hand it definitely looked that problem is worsening with time, even when node process was restated multiple times. So I am not sure that problem is purely in software, could be hardware problem. |
#255 may have fixed this, do you still reproduce with the latest source code? |
I can confirm that 1.2.5 version of SerialPort fixed this problem and multiple parallel serial connections works correctly on RaspberryPi. Congrats! (Even though I already switched to Intel NUC with my project). |
Works better on the Intel NUC now too :-) |
I'm still having issues using serialport 1.2.5 and node 0.10.20 with 2 serial ports each at a baudrate of 115200. Data is received intermittently when I connect multiple devices whereas when I connect only 1 there isn't any problem receiving data. I'm using serialport to control two 3D printers so admittedly I'm going to be sending and receiving more data then the average. Maybe that higher throughput is part of why I'm seeing this? More chances for some race condition to occur? It seems to work randomly. I tried connecting both printers simultaneously using two instances of another program (pronsole) and they worked so the issue seems to be on node's side of things. Since I have no idea how to troubleshoot the issue I'm probably going to go the child process route as well. my code (sorry, mine is also not a trivial project): https://github.com/D1plo1d/construct-daemon/blob/develop/lib/drivers/abstract_serial_driver.coffee |
@D1plo1d, two questions:
OK, it's really one question and one leading statement :-) |
|
I'm going to close this due to age, but if you have any more trouble don't worry about reopening it. We'd love to solve the problem if it's within |
Found the same problem on my system today. I migrated from lubuntu with 7 ports (controlling different pieces of equipment in an automation system) and then I moved to Windows 8.1 on an intel NUC, after the first attempts to fix my code I realized that if I have 3 port declarations everything works wonderfully, just by adding an extra port declaration the ports (all of them stop working). I have a machine ready to be tested (code and connections, the code will LOOK like it works but in fact it isn't I can see the result of the commands on the different equipment in real time (sound, tvs, etc.) if needed, just let me know and I'll provide access to it. |
i experienced problems while reading from multiple ports simultaneously.
up to 4 ports everything worked fine, when adding a fifth port reading is strange.
Data is only received after another port sent data as well.
Some quick code to test:
Did anyone got similiar results or got an idea how to fix this? thank you.
The text was updated successfully, but these errors were encountered: