Search found 4 matches

by coayer
Thu Oct 14, 2021 11:41 am
Forum: General Discussion and Questions
Topic: uasyncio task freezing
Replies: 9
Views: 3948

Re: uasyncio task freezing

Is this the appropriate way to use timeouts on nonblocking sockets with asyncio?... I thought you were using blocking sockets. You can't use timeouts with nonblocking sockets as read(n) always returns immediately. With nonblocking sockets you need to explicitly code timeouts. The code here is an ex...
by coayer
Wed Oct 13, 2021 6:46 pm
Forum: General Discussion and Questions
Topic: uasyncio task freezing
Replies: 9
Views: 3948

Re: uasyncio task freezing

Thanks for the advice — I've swapped over to using await asyncio.wait_for(reader.read(X), Y) but it isn't raising a TimeoutError even if the socket is connected to an unreachable IP (the program hangs on that line). Is this the appropriate way to use timeouts on nonblocking sockets with asyncio? On ...
by coayer
Sun Oct 03, 2021 9:42 am
Forum: General Discussion and Questions
Topic: uasyncio task freezing
Replies: 9
Views: 3948

Re: uasyncio task freezing

I am using getaddrinfo, but directly on an IP address (1.1.1.1) so that I can create a socket to the DNS server — I'm doing the DNS lookup manually. That's not the line that is freezing though, it's the "await reader.read(8)" after a "writer.write" and "await writer.drain".
by coayer
Sat Oct 02, 2021 7:54 pm
Forum: General Discussion and Questions
Topic: uasyncio task freezing
Replies: 9
Views: 3948

uasyncio task freezing

Hi everyone, I have a uasyncio task running on an ESP8266 which sends DNS lookups (UDP). I'm using uasyncio.StreamReader (and writer) on the socket object to do this asynchronously. Most requests are successful, but sometimes the task indefinitely hangs on "await reader.read(128)", which is reading ...