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

Mojave Electron serialport/bindings/poller error Error: bad file descriptor #1935

Closed
deveind opened this issue Sep 20, 2019 · 2 comments
Closed

Comments

@deveind
Copy link

deveind commented Sep 20, 2019

Summary of Problem

(Please answer all 3)

  • What are you trying to do?
    When disconnecting the USB connection of an open port that was already used for a write command on Mojave 10.14.6 and Electron 1.8.0 nor ERROR or CLOSE Events are thrown
  • What happens?
    It can be seen that the debugger throws endless loop traces
    serialport/bindings/poller error Error: bad file descriptor +0ms
    Which brings the process to virtually hang. We also use the USB Library to identify connects and disconnects. But in this case even these handlers are not reached anymore
  • What should have happened?
    An error should be thrown or a disconnect or close event

Code to Reproduce the Issue

const transport = function({ comName }) {
  return new Promise((resolve, reject) => {
    // Argument validation
    if (!comName || typeof comName !== 'string') {
      reject(new Error('\"comName\" argument of type String required'))
    }

    // SerialTransport object
    const port = new SerialPort(comName, {
      lock: false,
      baudRate: 57600,
      dataBits: 8,
      stopBits: 1,
      parity: 'odd'
    });

    // SerialTransport events
    port.on('open', function() {
      console.log('Opening port ', comName);
      resolve(port)
    });
    port.on('error', function(error) {
      console.log('Error on port ', comName);
      reject(error)
    });
    port.on('close', function(error) {
      console.log('Close on port ', comName);
      reject(error)
    });
  })
}

module.exports = transport

// Code

Versions, Operating System and Hardware

  • SerialPort@?
    "serialport": "^7.1.5",

  • Node.js v?
    8.2.1

  • Windows? Linux? Mac?
    MAC

  • Hardware and chipset? (Prolific/FTDI/Other)
    microchip mcp2200

This worked however on previous OSX Versions

@deveind
Copy link
Author

deveind commented Sep 22, 2019

Hello

the issue mentioned #1243
and the current Fix request #1803 and #1804 seem to fix also my issue.

  1. connect
  2. write to a port
  3. keep port open
  4. unplug USB
  5. infinite loop in poller without disconnect or propagation of the error event to a higher level

So my question is when #1804 is going to be merged?
May I help somehow.

Thanks.

@stale
Copy link

stale bot commented Nov 21, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week no further activity occurs. Feel free continue the discussion or ask for a never-stale label to keep it open. If this is a support issue, consider sharing it on stack overflow to get more eyes on your problem.

@stale stale bot added the stale-issue label Nov 21, 2019
@stale stale bot closed this as completed Nov 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

1 participant