Closed svdasein closed 9 months ago
@svdasein
Looking at your stuff - it looks like you're bundling your own serial logic
This package doesn't do anything with the serial port - other then list what's available on the system- it's all managed by the zwave-js library, that this module uses, and zwave-js is using the popular serialnode
package for all serial interaction.
ZWaveError: Failed to open the serial port: Error Resource temporarily unavailable Cannot lock port (ZW0100)
Log file please to capture all events leading up to and including this event - you can enable logging in the Controller Node (set to File
, Debug
) - the log will be in ~/.node-red
Please don't edit the log file - just upload the file as is.
whilst I wait for the log file, I'll ping @AlCalzone, to see if he has any immediate input with any known issues with Node 20 and the serilaport
package - But he is on parental leave currently - so please allow some time
This module will bring down the driver (and in doing so, will release the serial port - see below) - so my guess is, this is an issue with serilaport
and node 20 - its already been reported by another user -> https://github.com/serialport/node-serialport/issues/2735
No known issues from my side, but the linked issue seems to be a reasonable explanation for the behavior. Does the node-red serialport plug in also use this library?
it does
Everything is being closed down according to log.
2023-12-10T20:32:19.536Z DRIVER all queues idle
2023-12-10T20:32:26.757Z NDERED [SHUTDOWN] [RESTART] Cleaning up...
2023-12-10T20:32:26.759Z DRIVER destroying driver instance...
2023-12-10T20:32:26.901Z DRIVER driver instance destroyed
2023-12-10T20:32:27.671Z NDERED [options] [interview.queryAllUserCodes] Disabled
2023-12-10T20:32:27.672Z NDERED [options] [disableOptimisticValueUpdate] Disabled
2023-12-10T20:32:27.672Z NDERED [options] [enableSoftReset] Disabled
2023-12-10T20:32:27.672Z NDERED [options] [storage.cacheDir] /home/nodered/.node-red/zwave-js-cache
2023-12-10T20:32:27.672Z NDERED [options] [storage.throttle] normal
2023-12-10T20:32:27.672Z NDERED [options] [preferences.scales.temperature] 0x00
2023-12-10T20:32:27.673Z NDERED [options] [preferences.scales.humidity] 0x00
2023-12-10T20:32:27.673Z NDERED [FWUS] Open source license applied
2023-12-10T20:32:27.673Z NDERED Initializing driver...
2023-12-10T20:32:27.678Z NDERED [TELEMETRY] Disabling...
2023-12-10T20:32:27.678Z NDERED Starting driver...
2023-12-10T20:32:27.679Z DRIVER ███████╗ ██╗ ██╗ █████╗ ██╗ ██╗ ███████╗ ██╗ ███████╗
╚══███╔╝ ██║ ██║ ██╔══██╗ ██║ ██║ ██╔════╝ ██║ ██╔════╝
███╔╝ █████╗ ██║ █╗ ██║ ███████║ ██║ ██║ █████╗ ██║ ███████╗
███╔╝ ╚════╝ ██║███╗██║ ██╔══██║ ╚██╗ ██╔╝ ██╔══╝ ██ ██║ ╚════██║
███████╗ ╚███╔███╔╝ ██║ ██║ ╚████╔╝ ███████╗ ╚█████╔╝ ███████║
╚══════╝ ╚══╝╚══╝ ╚═╝ ╚═╝ ╚═══╝ ╚══════╝ ╚════╝ ╚══════╝
2023-12-10T20:32:27.679Z DRIVER version 12.4.0
2023-12-10T20:32:27.679Z DRIVER
2023-12-10T20:32:27.679Z DRIVER starting driver...
2023-12-10T20:32:27.679Z DRIVER opening serial port /dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bri
dge_Controller_a42420fe1da4eb118cc928259da30875-if00-port0
2023-12-10T20:32:37.031Z DRIVER Failed to open the serial port: Error Resource temporarily unavailable Cannot
lock port
2023-12-10T20:32:37.033Z DRIVER destroying driver instance...
2023-12-10T20:32:37.034Z NDERED [ERROR] [DRIVER] Failed to open the serial port: Error Resource temporarily un
available Cannot lock port (ZW0100)
2023-12-10T20:32:37.037Z DRIVER driver instance destroyed
It may be the case that whatever is wrong is something that was fixed by whoever maintains node-red-node-serialport - as I mentioned, when I upgraded that the problem with port locks that use that node went away.
├── node-red-node-serialport@2.0.2
fyi I actually walked the version of node-red-node-serialport upwards 'til the problem went away. I believe 2.0.2 is the very latest version.
@svdasein
My suggestion is to downgrade to Node 18 for the time being (its still preferred for Node RED at this stage) Or if you don't want to do that - Just only publish modified nodes - instead of a full deploy, to stop everything re-starting
Nothing in this module will be responsible for the error, as I believe it to be upstream somewhere.
@marcus-j-davies - thanks - I will try that.
After a downgrade to node v18.17.1 the problem no longer occurs. Thanks for your help!
What happened?
A few days ago I updated nodejs and node-red on a raspi4. Prior to the upgrade all was well. Subsequent to the upgrade I'm seeing an issue that I believe I've narrowed down to serial port logic in node-red-contrib-zwave-js:
If I leave the zwave js controller node enabled when I do a "deploy" or "restart nodes", that port will subsequently become unavailable due to some problem with port locking. The controller node emits messages about being unable to lock the usb port.
ZWaveError: Failed to open the serial port: Error Resource temporarily unavailable Cannot lock port (ZW0100)
The only way I have found to recover from this is to restart node-red itself. Once I do that, the controller node works properly again.
I have managed to work around this by being sure to disable + deploy the disable before doing other work. If I do that I can reliably bring the controller back up by enabling the controller node + deploy.
I looked at a LOT of stuff tracking this down, so I'm pretty sure it's somewhere in your stuff. Briefly:
I'm just guessing, but it seems like the issue might be sort of in one of these ballparks:
Versions:
How to reproduce?
Version
9.0.3
Node-RED Version
3.1.3
What hardware are you seeing the problem on?
Raspberry Pi
Relevant Z-Wave-JS log as a text file
ZWaveError: Failed to open the serial port: Error Resource temporarily unavailable Cannot lock port (ZW0100)