micropython-lib icon indicating copy to clipboard operation
micropython-lib copied to clipboard

Non-blocking usocket.socket().read() blocks

Open ian-llewellyn opened this issue 5 years ago • 1 comments

My Sonoff TH with 8266 board and MicroPython 1.11 "locks up" regularly (likely after some network disruption). After sending a ping to the device, I can reconnect to WebREP and interrupt the uasyncio.get_event_loop().run_forever().

I get this traceback every time (roughly daily, sometimes less often).

Welcome to MicroPython!
Password:
WebREPL connected
>>> Ctrl-C
Traceback (most recent call last):
  File "main.py", line 9, in <module>
  File "main.py", line 6, in start
  File "uasyncio/core.py", line 154, in run_forever
  File "uasyncio/core.py", line 109, in run_forever
  File "circ.py", line 102, in mqtt_sub_worker
  File "umqtt/simple.py", line 204, in check_msg
  File "umqtt/robust.py", line 42, in wait_msg
  File "umqtt/robust.py", line 40, in wait_msg
  File "umqtt/simple.py", line 168, in wait_msg
KeyboardInterrupt:
>>> 

https://github.com/micropython/micropython-lib/blob/f20d89c6aad9443a696561ca2a01f7ef0c8fb302/umqtt.simple/umqtt/simple.py#L168

ian-llewellyn avatar Apr 08 '20 17:04 ian-llewellyn

can you try to pull #385 and see if it fixes your issue ?

EddieParis avatar May 05 '20 19:05 EddieParis