Skip to content

read_device_information framer regression from 3.11.4 to 3.12.0 #2881

@aseligmann

Description

@aseligmann

Versions

  • Python: 3.11.2
  • OS: Raspbian (Debian Bookworm)
  • Pymodbus: 3.12.0
  • Modbus Hardware (if used): Custom

Pymodbus Specific

  • Server: N/A
  • Client: RTU Async

Description

What I'm doing: Calling read_device_information() over RTU serial (RS-485, 1 Mbaud).

What happens: The device responds correctly (the full response bytes are visible in the debug log), but the frame is not reassembled correctly. All retries fail the same way. Eventually the request fails with a ModbusIOException.

What I expected: The same behavior as 3.11.4, where the response is decoded successfully.

Versions tested:

  • 3.11.4 - works
  • 3.12.0 - broken

Code and Logs

Version 3.12.0

$ python3 -m venv .venv && source .venv/bin/activate && pip install pymodbus==3.12.0 pyserial && python -c "
import asyncio
import pymodbus
from pymodbus.client import AsyncModbusSerialClient
from pymodbus import FramerType
from serial.rs485 import RS485Settings
import serial
import logging

pymodbus.pymodbus_apply_logging_config(logging.DEBUG)

async def main():
    client = AsyncModbusSerialClient(port='/dev/ttyAMA4', framer=FramerType.RTU, baudrate=1000000, timeout=0.1, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE)
    await client.connect()
    client.ctx.transport.sync_serial.rs485_mode = RS485Settings(rts_level_for_tx=True, rts_level_for_rx=False, delay_before_tx=0.0, delay_before_rx=0.0)
    await asyncio.sleep(0.1)
    resp = await client.read_device_information(device_id=8, read_code=1, object_id=0x00)
    print(resp.information)
    client.close()

asyncio.run(main())
"
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pymodbus==3.12.0
  Using cached https://www.piwheels.org/simple/pymodbus/pymodbus-3.12.0-py3-none-any.whl (167 kB)
Collecting pyserial
  Using cached https://www.piwheels.org/simple/pyserial/pyserial-3.5-py2.py3-none-any.whl (90 kB)
Installing collected packages: pyserial, pymodbus
Successfully installed pymodbus-3.12.0 pyserial-3.5
2026-02-18 13:56:46,455 DEBUG base:56 Connecting to /dev/ttyAMA4:0.
2026-02-18 13:56:46,455 DEBUG transport:248 Connecting comm
2026-02-18 13:56:46,456 DEBUG transport:284 Connected to comm
2026-02-18 13:56:46,656 DEBUG transport:390 send: 0x8 0x2b 0xe 0x1 0x0 0xac 0x76
2026-02-18 13:56:46,657 DEBUG transport:336 recv: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69 extra data:
2026-02-18 13:56:46,657 DEBUG transport:340 End Of Frame detected, clearing buffer:
2026-02-18 13:56:46,657 DEBUG base:72 Processing: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,658 DEBUG rtu:102 Frame - not ready
2026-02-18 13:56:46,658 DEBUG transport:349 extra:  unexpected data: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,658 DEBUG transport:336 recv: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b extra data: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,658 DEBUG transport:340 End Of Frame detected, clearing buffer: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,658 DEBUG base:72 Processing: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b
2026-02-18 13:56:46,658 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,658 DEBUG rtu:109 Repeating....
2026-02-18 13:56:46,659 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,659 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,659 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,659 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,659 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,659 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,659 DEBUG rtu:102 Frame - not ready
2026-02-18 13:56:46,659 DEBUG transport:349 extra:  unexpected data: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b
2026-02-18 13:56:46,757 DEBUG transport:390 send: 0x8 0x2b 0xe 0x1 0x0 0xac 0x76
2026-02-18 13:56:46,760 DEBUG transport:336 recv: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69 extra data:
2026-02-18 13:56:46,760 DEBUG transport:340 End Of Frame detected, clearing buffer:
2026-02-18 13:56:46,760 DEBUG base:72 Processing: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,760 DEBUG rtu:102 Frame - not ready
2026-02-18 13:56:46,760 DEBUG transport:349 extra:  unexpected data: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,761 DEBUG transport:336 recv: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b extra data: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,761 DEBUG transport:340 End Of Frame detected, clearing buffer: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,761 DEBUG base:72 Processing: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b
2026-02-18 13:56:46,761 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,761 DEBUG rtu:109 Repeating....
2026-02-18 13:56:46,761 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,761 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,761 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,761 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,762 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,762 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,762 DEBUG rtu:102 Frame - not ready
2026-02-18 13:56:46,762 DEBUG transport:349 extra:  unexpected data: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b
2026-02-18 13:56:46,858 DEBUG transport:390 send: 0x8 0x2b 0xe 0x1 0x0 0xac 0x76
2026-02-18 13:56:46,863 DEBUG transport:336 recv: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69 extra data:
2026-02-18 13:56:46,863 DEBUG transport:340 End Of Frame detected, clearing buffer:
2026-02-18 13:56:46,863 DEBUG base:72 Processing: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,863 DEBUG rtu:102 Frame - not ready
2026-02-18 13:56:46,863 DEBUG transport:349 extra:  unexpected data: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,863 DEBUG transport:336 recv: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b extra data: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,864 DEBUG transport:340 End Of Frame detected, clearing buffer: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,864 DEBUG base:72 Processing: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b
2026-02-18 13:56:46,864 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,864 DEBUG rtu:109 Repeating....
2026-02-18 13:56:46,864 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,864 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,864 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,864 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,864 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,864 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,864 DEBUG rtu:102 Frame - not ready
2026-02-18 13:56:46,864 DEBUG transport:349 extra:  unexpected data: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b
2026-02-18 13:56:46,959 DEBUG transport:390 send: 0x8 0x2b 0xe 0x1 0x0 0xac 0x76
2026-02-18 13:56:46,959 DEBUG transport:336 recv: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69 extra data:
2026-02-18 13:56:46,959 DEBUG transport:340 End Of Frame detected, clearing buffer:
2026-02-18 13:56:46,959 DEBUG base:72 Processing: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,959 DEBUG rtu:102 Frame - not ready
2026-02-18 13:56:46,959 DEBUG transport:349 extra:  unexpected data: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,959 DEBUG transport:336 recv: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b extra data: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,959 DEBUG transport:340 End Of Frame detected, clearing buffer: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:46,959 DEBUG base:72 Processing: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b
2026-02-18 13:56:46,960 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,960 DEBUG rtu:109 Repeating....
2026-02-18 13:56:46,960 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,960 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,960 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,960 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,960 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,960 DEBUG rtu:109 Frame check failed, possible garbage after frame, testing..
2026-02-18 13:56:46,960 DEBUG rtu:102 Frame - not ready
2026-02-18 13:56:46,960 DEBUG transport:349 extra:  unexpected data: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b
2026-02-18 13:56:47,059 ERROR transaction:200 No response received after 3 retries, continue with next request
Traceback (most recent call last):
  File "<string>", line 21, in <module>
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "<string>", line 17, in main
  File "/home/pi/pymodbus3120/.venv/lib/python3.11/site-packages/pymodbus/transaction/transaction.py", line 201, in execute
    raise ModbusIOException(txt)
pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] No response received after 3 retries, continue with next request

Version 3.11.4

$ python3 -m venv .venv && source .venv/bin/activate && pip install pymodbus==3.11.4 pyserial && python -c "
import asyncio
import pymodbus
from pymodbus.client import AsyncModbusSerialClient
from pymodbus import FramerType
from serial.rs485 import RS485Settings
import serial
import logging

pymodbus.pymodbus_apply_logging_config(logging.DEBUG)

async def main():
    client = AsyncModbusSerialClient(port='/dev/ttyAMA4', framer=FramerType.RTU, baudrate=1000000, timeout=0.1, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE)
    await client.connect()
    client.ctx.transport.sync_serial.rs485_mode = RS485Settings(rts_level_for_tx=True, rts_level_for_rx=False, delay_before_tx=0.0, delay_before_rx=0.0)
    await asyncio.sleep(0.1)
    resp = await client.read_device_information(device_id=8, read_code=1, object_id=0x00)
    print(resp.information)
    client.close()

asyncio.run(main())
"
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pymodbus==3.11.4
  Using cached https://www.piwheels.org/simple/pymodbus/pymodbus-3.11.4-py3-none-any.whl (166 kB)
Collecting pyserial
  Using cached https://www.piwheels.org/simple/pyserial/pyserial-3.5-py2.py3-none-any.whl (90 kB)
Installing collected packages: pyserial, pymodbus
Successfully installed pymodbus-3.11.4 pyserial-3.5
2026-02-18 13:56:05,746 DEBUG base:56 Connecting to /dev/ttyAMA4:0.
2026-02-18 13:56:05,746 DEBUG transport:242 Connecting comm
2026-02-18 13:56:05,747 DEBUG transport:278 Connected to comm
2026-02-18 13:56:05,947 DEBUG transport:376 send: 0x8 0x2b 0xe 0x1 0x0 0xac 0x76
2026-02-18 13:56:05,948 DEBUG transport:330 recv: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69 extra data:
2026-02-18 13:56:05,948 DEBUG base:72 Processing: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:05,948 DEBUG rtu:117 Frame - not ready
2026-02-18 13:56:05,948 DEBUG transport:335 extra:  unexpected data: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:05,948 DEBUG transport:330 recv: 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b extra data: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69
2026-02-18 13:56:05,948 DEBUG base:72 Processing: 0x8 0x2b 0xe 0x1 0x83 0x0 0x0 0x3 0x0 0xf 0x52 0x65 0x73 0x68 0x61 0x70 0x65 0x20 0x42 0x69 0x6f 0x74 0x65 0x63 0x68 0x1 0x1 0x38 0x2 0x5 0x31 0x2e 0x31 0x2e 0x36 0x61 0x2b
2026-02-18 13:56:05,949 DEBUG decoders:79 decoded PDU function_code(43 sub 14) -> ReadDeviceInformationResponse(dev_id=1, transaction_id=0, address=0, count=0, bits=[], registers=[], status=1, retries=0)
{0: b'Reshape Biotech', 1: b'8', 2: b'1.1.6'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions