Skip to content

ReadFileRecordRequest.execute() doesn't wait for complete pdu #708

@theobarkerh

Description

@theobarkerh

Versions

  • Python: 3.8.10
  • OS: Ubuntu 20.04, Windows 10
  • Pymodbus: 2.3.5
  • Modbus Hardware (if used): Hach Company reference implementation - slave

Pymodbus Specific

  • Server: none
  • Client: /rtu - sync

Description

When trying to read a file using the ReadFileRecordRequest (Function code 20), the pymodbus.transaction transitions from WAITING FOR REPLY to PROCESSING REPLY before all of the response has been received. This results in the client application receiving many "Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response". The application must continue the retry roulette until it receives a complete record response.

One problem is that there is no get_response_pdu_size() member defined for ReadFileRecordRequest.

Code and Logs

             rec = FileRecord(reference_type=self.REFERENCE_TYPE, file_number=file_number, record_number=(i*RECORD_LENGTH), record_length=rec_len)
            records.append(rec)

            request = ReadFileRecordRequest(records=records, unit=self.slave_unit)
            response = self.client.execute(request)


DEBUG:pymodbus.transaction:SEND: 0x1 0x14 0x7 0x6 0x0 0x18 0x0 0x0 0x0 0x1a 0x58 0xed
DEBUG:pymodbus.framer.rtu_framer:Changing state to IDLE - Last Frame End - None, Current Time stamp - 1643687749.313818
DEBUG:pymodbus.client.sync:New Transaction state 'SENDING'
DEBUG:pymodbus.transaction:Changing transaction state from 'SENDING' to 'WAITING FOR REPLY'
DEBUG:pymodbus.transaction:Changing transaction state from 'WAITING FOR REPLY' to 'PROCESSING REPLY'
DEBUG:pymodbus.transaction:RECV: 0x5e 0x20 0x8e 0x69 0xc2 0x29 0xb2 0x94 0xbf 0xcc 0x5b 0xf6 0x60 0x1e 0x51 0x5b 0xc2 0x5 0xc5 0xba 0x40 0x0
DEBUG:pymodbus.framer.rtu_framer:Frame check failed, ignoring!!
DEBUG:pymodbus.framer.rtu_framer:Resetting frame - Current Frame in buffer - 0x5e 0x20 0x8e 0x69 0xc2 0x29 0xb2 0x94 0xbf 0xcc 0x5b 0xf6 0x60 0x1e 0x51 0x5b 0xc2 0x5 0xc5 0xba 0x40 0x0
DEBUG:pymodbus.transaction:Getting transaction 1
DEBUG:pymodbus.transaction:Changing transaction state from 'PROCESSING REPLY' to 'TRANSACTION_COMPLETE'
WARNING:probe:file read response is Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response.

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