miguelgrinberg/microdot

Micropython OSError 110 ETIMEDOUT

zzjlamb opened this issue · 8 comments

Thanks for your work.

I'm getting the following non-fatal error on RPi Pico W running MicroPython v1.19.1-900-gfc4c47f7b running minimal code:

Traceback (most recent call last):
  File "microdot.py", line 1106, in handle_request
  File "microdot.py", line 379, in create
  File "microdot.py", line 491, in _safe_readline
OSError: [Errno 110] ETIMEDOUT

It occurs intermittently when a request is read. Should I be changing a setting in Microdot?

This is the main module:

from microdot import Microdot
import do_connect

do_connect.do_connect()   # Set up wifi connection

app = Microdot()

@app.route('/')
def index(request):
    return 'Hello, world!'

app.run()

Hmm, okay. This is related to a change I've made a few days ago that adds socket timeouts (which were supposed to be handled, the Pico is returning errno code 110, but I was expecting errno 60 for a socket timeout).

You can disable the timeouts with the following:

Request.socket_read_timeout = None

I think that will eliminate the stack trace in your log. And I'll add handling for errno 110 in a fix soon.

Thanks for the fast reply.

Request.socket_read_timeout = None

fixed it.

You should be able to keep the timeout enabled now, I think.

mgsb commented

I ran across this today. I found that the default 0.1 second was too low for ESP32 variants running MicroPython. I got timeouts in both header and body processing. I set to 1 second and soaking has not shown any timeouts. YMMV.

Thanks for the great package - I am enjoying using it after previous usage of Flask/Bottle.

In my ESP32 micropython setup, errno.ETIMEDOUT is 116 , i.e. neither 60 nor 110. Maybe it would be better to write

            if exc.errno and exc.errno != errno.ETIMEDOUT:

instead of

            if exc.errno and exc.errno not in [60, 110]:

That worked for me

Please I got the same error with bluetooth module
Here is the code :

import bluetooth
ble = bluetooth.BLE()
ble.active(True)

after ble.active(True) i got :

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 110] ETIMEDOUT

Can you help me please ?

@abel2319 this project does not use Bluetooth, so unfortunately I cannot help with your issue. Sorry.

I’ve been encountering the same issue with Errno 110. I have the original main code and library available for review. Could someone assist me in resolving this problem?
BME680_library.txt
main code.txt