-
Notifications
You must be signed in to change notification settings - Fork 13
RuntimeError: Repeated socket failures on ESP32-S2 #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A more minimal example:
|
Regarding resets: Repeating a soft reset multiple times can 'clear' the error |
|
Running I'm a relative newbie to sockets/SSL, but it looks like Requests keeps hold of sockets to re-use them. Hoping someone more experienced than me can verify and suggest possible improvements. |
Same general issue -> Repeated socket errors on the requests library. I have two scenarios and the only difference is one scenario will deep sleep and one will just In a way, i can see the value of using Using CircuitPython 8.2.6. This is easy to replicate for me on a few ESP32 board types under each scenario. The time it takes for the code to stop varies, but happens within a 24 hour period. |
I realise Adafruit folks are working on this library at the moment, so perhaps this will work itself out as part of that.
However, I've been running into issues when trying to use IoTCentralDevice.
azureiot_central_simpletest.py does work for me
However if I remove the if statement
if time.localtime().tm_year < 2022:
then the code runs once, but fails after a soft reset or reload.
A hard reset typically gets it going again, but the behaviour doesn't seem to be 100% repeatable.
I'd like to understand why, so I can use requests and MQTT reliably in the same code.
(I've run into similar weirdness when using AdafruitIO, which was my motivation to try Azure in the first place, but I think it could be a more fundamental issue with sockets in circuitpython / ESP32-S2)
I wonder if it is related to Anecdata's comment about ESP32-S2 only supporting 4 sockets adafruit/Adafruit_CircuitPython_Requests#62 (comment)
Perhaps after a soft reset the sockets aren't being cleared... somehow!
Digging into the libraries a little bit shows me the error occurs here:
https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/blob/c4517bbbde70e2dc7fdb1a1fcfe120d1b6b2f530/adafruit_minimqtt/adafruit_minimqtt.py#L279
adding some print()s reveals that it fails to get a socket because of:
Would be great to understand what is going on so we can avoid it or handle it better.
My test code, slightly modified from the simpletest :
The text was updated successfully, but these errors were encountered: