-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Segfaults during list()
that crashes Node when encountering certain types of serial ports
#2155
Comments
I can confirm that the same issue is happening for our users (at least 5) who have devices listed under "Ports (COM & LPT)" without a COM port number. In one specific instance, the device without COM port number is a Brother HL-L2350DW printer. Serialport 9.0.2 Ours is an Electron app, so when the segfault occurs the entire window just goes blank, without any error messages. It took us forever to figure out what was going on, so thank you so much for reporting this @petertorelli ! Any workarounds for this one, @reconbot ? |
@gniezen FYI: I am also using this under an ElectronJS application, but it also happens under a plain NodeJS process as well. |
Well this doesn't happen for everyone, and without segfault information I can't tell you what's going on. I've seen a lot of issues with bad serial drivers responding to the registry queries poorly or just crashing but it could also be data in a format we don't expect. I'd need more info to make a diagnosis, if you look at the source you can see what registry paths we're looking at. |
Hi @reconbot, I'd like to provide more information, what would help? A core dump from the cygwin session? I don't debug windows very often (except inside VStudio) so tell me what you need and I'll get it. Thanks, |
I have this issue too and I searched into the source code of this library and I think that the error comes with the call |
That is the function that does the listing, we'd need some c++ debugging to find out what it's doing wrong. |
I don't know much about debugging c++ on windows either, a core dump is probably the place to start. Building with debug mode ( |
Hi @reconbot, I finally carved out some time this weekend to dive back into this, and the hardware that routinely caused this problem...... no longer creates an un-associated COM port. Would you prefer I close this until I can reproduce the fail again and collect core-dump data, or should I leave it open for the other folks on the list? Thanks, |
Let's leave it open. We can let stale bot close it if nobody else pipes up. |
I'm trying to think of the easiest way to have non-techie users send us details on this error. It should be able to be reproducible with the SerialPort List command-line tool, right? So I'm thinking to ask them to:
Could that get you what you need @reconbot ? Or does |
Printing the NodeJS This is a rather convoluted way to get a core dump, but do you have Cygwin installed? If you can run the serialport-list function and cause a segfault, it should create a Peter |
@petertorelli I'm sorry if I wasn't clear - I cannot reproduce it myself, but we've identified users of our software that want to help out to get this resolved. Unfortunately they don't have the technical know-how to set up Cygwin, so I was wondering how we can set up a minimal example that they could run to generate what is needed to investigate this further. |
I suppose you can put a bunch of print statements in the c++ code and compile it and run it. It's not a stack trace but it will absolutely point us the right direction. |
Hi there, |
This appears to be related to #1830, as we've also had a report of a Brother printer not being assigned a COM port by Windows. |
@petertorelli No, I've been trying to create a test build with an initialized |
You can stick a bunch of |
Has anyone managed to replicate this issue without access to the particular hardware in question? I've tried in mapping, remapping or generally messing up the com port mapping in windows and I just can't seem to replicate the issue. I have a suspicion that we could change the windows APIs that we use to bypass this issue, but without being able to replicate the issue I don't know how much progress can be made |
@GazHank, |
@petertorelli @GazHank @hisasan see #2325 Thank you @hisasan for #2155 (comment) and @petertorelli for #2155 (comment) – you guys hit the nail on the head! |
Summary of Problem
(Please answer all 3)
Code to Reproduce the Issue
Versions, Operating System and Hardware
The DA16200 appears to create a SerialPort device that windows cannot assign to a COM port. Unfortunately, the
node-serialport
module segfaults with no indication of an error when it encounters this device: I can't evencatch()
it and recover, the process just ends. Even when I run withDEBUG=*
I see no other messages. Windows Command Prompt prints nothing but Cygwin offers a clue:Here is a picture of the orphan Serial Port appearing in Device Manager:
How do I enable better error handling so that my application doesn't segfault due to serialport?
The text was updated successfully, but these errors were encountered: