SerialPort on Node v20 incurs high CPU load.
mousseq opened this issue · 5 comments
SerialPort Version
8.0.2
Node Version
20.4.0
Electron Version
No response
Platform
Linux pi4-1 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
Architecture
Raspberry Pi 4 (ARM)
Hardware or chipset of serialport
FTDI
What steps will reproduce the bug?
The enclosed program opens three serial ports and reads from them (and does nothing with the data). The ports receive data at relatively modest rates (1000 bytes 30 times a second).
What happens?
When built and run with Node v19.8.1, the CPU load is negligible. When built and run with Node v20, the CPU load increases dramatically. One of the four cores runs at 100%. The machine is a Raspberry Pi 4 running the Debian Bullseye version of the OS.
What should have happened?
I expect that the CPU load will not very significantly between the Node 19.8.1 and Node 20.4 versions.
sptest.tar.gz
Additional information
No response
Would you be able to check if you experience the same issue with node 20.2?
thanks @mousseq
In that case I strongly suspect this is related to the node js upgrade of libuv which occurred in node 20.3. Issue #2656 is another symptom of this.
I'm trying to investigate the root cause and get sufficient info about the problem so that we can get a fix applied to libuv, but it's proving a bit messy/time consuming so far.
node 20.8.1 and 21.0.0 are still affected.
Thanks for the hint regarding node 20.2. That version works still very well.
News on this?