Skip to content

RTU Framer discards packets splitted into two calls to "processIncomingPacket" #394

@RonnyDe1982

Description

@RonnyDe1982

Versions

  • Python: 3.6.7
  • OS: Ubuntu 18.10
  • Pymodbus: 2.1.0 (rtu_framer.py function ProcessIncomingPacket patched to 2.2.0)
  • Modbus Hardware (if used):

Pymodbus Specific

  • Server: rtu - async

Description

The RTU Framer had a known issue related to modbus requests not served by the library but other physical modbus devices. This issues seems to be fixed in branch "pymodbus-2.2.0".

However, the suggested bugfix in pymodbus/rtu:framer.py, lines 231-233 introduces another problem for large modbus requests which cannot be passes in one single data frame to the function processIncomingPacket.

Whenever an incomplete packet has been received this packet is discarded since "checkFrame" returns false.

Known workaround:

if self.isFrameReady():
            if self.checkFrame():
                if self._validate_unit_id(unit, single):
                    self._process(callback)
                else:
                    _logger.debug("Not a valid unit id - {}, "
                                  "ignoring!!".format(self._header['uid']))
                    self.resetFrame()
            else:
                if len(self._buffer) > self._header["len"]:
                       _logger.debug("Frame check failed, ignoring!!")
                      self.resetFrame()
        else:
            _logger.debug("Frame - [{}] not ready".format(data))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions