Potential Bug with modbus over serial on bullseye

Hi Everyone

I might have found a potential bug on node red 3.1

Environment

  • Pi4b with bullseye 32bit
  • Nodered 3.1 installed via script
  • start as service on boot
  • node-red-contrib-modbus 5.26.0
  • bare minimum flow setup as below

The bug

  • modbus via serial tty0 works fine on boot
  • but it would stop working after I deploy and update to the flow
  • after about 10 minutes modbus via serial would work again automatically (I tried a few times, always approx. 10 minutes, refer to screenshot for exact timeout duration)
  • if I manually do node-red-stop then node-red-start, modbus would start working immediately
  • this bug does not exist on buster, I tested and modbus keep working after every deploy

Sorry I couldn't test further why this 10minute time out issue on bullseye, limited knowledge of linux.
d09fe81b5a6aae5427fae8f27b67ccc

[
    {
        "id": "7c54e13bb9f3d04d",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "354c5ff55bd6b705",
        "type": "inject",
        "z": "7c54e13bb9f3d04d",
        "name": "interval",
        "props": [
            {
                "p": "topic",
                "v": "",
                "vt": "date"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": true,
        "onceDelay": "2.5",
        "topic": "",
        "x": 260,
        "y": 500,
        "wires": [
            [
                "2342f926fad2ec1d"
            ]
        ]
    },
    {
        "id": "2342f926fad2ec1d",
        "type": "function",
        "z": "7c54e13bb9f3d04d",
        "name": "SOC",
        "func": "msg.payload = { \n    'fc': 4, \n    'unitid': 1, \n    'address': 0x311A, \n    'quantity': 1\n}\n\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 410,
        "y": 500,
        "wires": [
            [
                "be91aba91ba5f83e"
            ]
        ]
    },
    {
        "id": "09c72e188c904c36",
        "type": "modbus-response",
        "z": "7c54e13bb9f3d04d",
        "name": "View Response",
        "registerShowMax": 20,
        "x": 660,
        "y": 560,
        "wires": []
    },
    {
        "id": "be91aba91ba5f83e",
        "type": "modbus-flex-getter",
        "z": "7c54e13bb9f3d04d",
        "name": "Flex get uart",
        "showStatusActivities": false,
        "showErrors": false,
        "showWarnings": true,
        "logIOActivities": false,
        "server": "0713c2694f47eec6",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "delayOnStart": false,
        "startDelayTime": "",
        "x": 550,
        "y": 500,
        "wires": [
            [
                "fb208dc46429ba1d"
            ],
            [
                "09c72e188c904c36"
            ]
        ]
    },
    {
        "id": "fb208dc46429ba1d",
        "type": "debug",
        "z": "7c54e13bb9f3d04d",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 760,
        "y": 480,
        "wires": []
    },
    {
        "id": "0713c2694f47eec6",
        "type": "modbus-client",
        "name": "Pi ttyS0",
        "clienttype": "simpleser",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "127.0.0.1",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyS0",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "115200",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": "1",
        "commandDelay": "1",
        "clientTimeout": "1000",
        "reconnectOnTimeout": true,
        "reconnectTimeout": "2000",
        "parallelUnitIdsAllowed": true,
        "showWarnings": true,
        "showLogs": true
    }
]

In what way does it stop working?

Hi Colin

Sorry the language wasn't very precise, basically the communication to the modbus device stops completely for that 10 minute period.

The whole chain is like below.

Contrib-Modbus --> Node red 3.1 --> Bullseye --> tty0 --> TTL to 485 --> modbus device

I don't know how to diagnose where it breaks down, all I was able to verify is

  • using buster instead of bullseye, the problem does not exist

  • under bullseye, if the comms stopped, I can manually SSH node-red-stop then node-red-start to solve the problem

  • or I can just wait about 10 minutes

I have 2 sets of hardware setup, so I was able to cross check and made sure it's not the hardware fault

What do you see from the debug node when it stops working?

What status is shown on the getter node?

In a terminal window run node-red-stop then node-red-start and post the startup log here.
Then leave the window open and wait for the comms to fail. What do you see in the log.

Before you do that run
sudo apt update && sudo apt full-upgrade
to make sure your system packages are up to date. Check that command does not show any errors.

What do you see from the debug node when it stops working?

nothing

What status is shown on the getter node?

just like normal

I'll get some logs and post here soon

What does normal look like?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.