Skip to content

Segfaults during list() that crashes Node when encountering certain types of serial ports #2155

@petertorelli

Description

@petertorelli

Summary of Problem

(Please answer all 3)

  • What are you trying to do? Query the serial ports.
  • What happens? I get a segmentation fault when I plug in a particular device.
  • What should have happened? I should have seen the new device added.

Code to Reproduce the Issue

const serialport = require("serialport");
serialport.list().then(currentPorts => {
	console.log(currentPorts);
});

Versions, Operating System and Hardware

  • SerialPort@? 9.0.2
  • Node.js v? 12.18.0
  • Windows? Linux? Mac? Windows 10
  • Hardware and chipset? Dialog DA16200 debug port

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 even catch() it and recover, the process just ends. Even when I run with DEBUG=* I see no other messages. Windows Command Prompt prints nothing but Cygwin offers a clue:

Peter@CAPYBARA /cygdrive/c/Users/Peter/serialtmp
$ DEBUG=* node test-serial.js
  serialport/bindings loading WindowsBinding +0ms
  serialport/stream .list +0ms
Segmentation fault

Here is a picture of the orphan Serial Port appearing in Device Manager:

image

How do I enable better error handling so that my application doesn't segfault due to serialport?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions