-
-
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
serialport + electron, "close" event causes CPU spike #2323
Comments
Would you be able to share your project or example code? While I'm not able to test on Mac myself, if I can recreate the issue on another platform it might help get to the bottom of the problem |
Getting the same problem. Using a BLuetooth legacy device. Pairing it with Bluettoth first and then connecting via Serial port. If I disconnect the Bluetooth connection, the If I manually close the serial port connection via https://serialport.io/docs/api-stream#close-1, it is getting fired. |
Seeing the same thing here using zwave-js. It is hard to share my application environment that uses zwave-js and you probably don't have a zwave USB stick handy so below this is what I've noticed: Pausing the debugger while this is ongoing stops at 'unix-read.js'. See snippet below. Some observations:
Speculation: Maybe this is node dependent? This happens on:
const unixRead = async ({ binding, buffer, offset, length, fsReadAsync = readAsync, }) => {
logger('Starting read');
if (!binding.isOpen || !binding.fd) {
throw new errors_1.BindingsError('Port is not open', { canceled: true });
}
try {
const { bytesRead } = await fsReadAsync(binding.fd, buffer, offset, length, null);
if (bytesRead === 0) {
return (0, exports.unixRead)({ binding, buffer, offset, length, fsReadAsync });
}
logger('Finished read', bytesRead, 'bytes');
return { bytesRead, buffer };
}
catch (err) {
logger('read error', err);
|
This might be related to Issue #2043 |
node 10.20.1
serial port 8.0.8
electron 13.1.7
platform: OSX 10.14.6
I open a serialport in electron's "main" process and use Electron's IPC functions to bridge between renderer and main process. main process opens a serial port and creates an event handler for "close" and "data" events. "data" events work fine and so does writing to the serial port. But if I unplug the USB plug, disconnecting the arduino from the computer, the "close" event does not fire. Instead I get a CPU spike in the electron process (as seen in Activity Monitor app).
The text was updated successfully, but these errors were encountered: