Skip to content

process_message should not try and send zero bytes #46

@JimCircadian

Description

@JimCircadian

process_message will try and IMTWB a zero length message, but this shouldn't be attempted. In conjunction with v0.12.1 on the modem (see #43) it can result in an endless loop where the modem doesn't respond to the write request.

AT+CSQ?
+CSQ: -112,3                                                                                                     
OK                                                                                                               
AT+IMTMTS                                                                                                        
OK                                                                                                               
AT+IMTWB=0                                                                                                       
<nothing happens>

We should think about what happens in the scenario we receive nothing back from the modem, as it repeatedly does:

12:37:36                 DEBUG            Current queue size approx.: 1
12:37:36                 INFO             Command sent: "AT+CSQ?"
OK'37:36                 DEBUG            Reply received: '+CSQ: -113,3
OK"37:37                 INFO             Response received: "+CSQ: -113,3
12:37:37                 DEBUG            Got signal level 3
12:37:37                 DEBUG            Processing currently queued messages...
12:37:37                 INFO             Got binary message: 0 bytes (MAX: 100000)
12:37:37                 INFO             Command sent: "AT+IMTWB=0"
12:37:58                 WARNING          We've read 0 bytes continuously for 21.073892 seconds, abandoning reads...
12:37:58                 WARNING          Failed message handling, putting back to the queue...
12:37:58                 ERROR            Out of logic modem operations, breaking to restart...
12:37:58                 ERROR            Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/pyremotenode/comms/connections.py", line 322, in run
    num = self.process_outstanding_messages()
  File "/usr/local/lib/python3.5/dist-packages/pyremotenode/comms/connections.py", line 287, in process_outstanding_messages
    ret = self.process_message(msg[1])
  File "/usr/local/lib/python3.5/dist-packages/pyremotenode/comms/iridium.py", line 523, in process_message
    response = self.modem_command("AT+IMTWB={}".format(len(text)))
  File "/usr/local/lib/python3.5/dist-packages/pyremotenode/comms/connections.py", line 198, in modem_command
    raise ConnectionException("Response timeout from serial line...")
pyremotenode.comms.connections.ConnectionException: Response timeout from serial line...

12:37:58                 DEBUG            Closing and removing modem serial connection
12:38:18                 DEBUG            Sleeping for grace period of 2 seconds to allow modem boot
12:38:20                 INFO             Opening existing modem serial connection
12:38:20                 INFO             Command sent: "AT+CGMM"
OK'38:20                 DEBUG            Reply received: '+CGMM: "Mini"
OK"38:20                 INFO             Response received: "+CGMM: "Mini"
12:38:20                 INFO             Command sent: "AT+UNS=0"
12:38:20                 DEBUG            Reply received: 'OK'
12:38:20                 INFO             Response received: "OK"
12:38:20                 DEBUG            Current queue size approx.: 1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions