-
Notifications
You must be signed in to change notification settings - Fork 131
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
it looks like some socket methods can block doing dns resolution? #118
Comments
You may be right about |
Oh, so |
Yup. I'm still trying to figure out if asyncio is capable of supporting an async socket abstraction via transports and protocols, but until then, the internal Socket class is private. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was just investigating some performance issues in trio, and in the process noticed an issue in curio that it looks like anyio might share: anywhere you accept a socket address and pass it through to the stdlib
socket
module, thesocket
module will happily accept a hostname and then do a blocking DNS lookup. This is pretty annoying, but whaddaygonnado.Asyncio and Trio both handle this by automatically resolving hostnames on their own, before passing them to the stdlib
socket
module. Curio doesn't seem to handle it, and I guess expects the user to pre-resolve all hostnames.Looking at the v1 code currently, I think anyio's
bind
method does use a thread when it detects that the address has a hostname in it, but all the other methods that take addresses –connect
,sendto
, etc. – all pass the address through to stdlibsocket
directly, so can accidentally block doing DNS lookups.The text was updated successfully, but these errors were encountered: