Skip to content
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

Can't UDP sendto named host #91

Closed
richardkiss opened this issue May 15, 2017 · 2 comments
Closed

Can't UDP sendto named host #91

richardkiss opened this issue May 15, 2017 · 2 comments

Comments

@richardkiss
Copy link

  • uvloop v0.80:
  • Python 3.6.1:
  • Platform Mac OS X:
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env? yes:

In uvloop 0.8.0, an error occurs when sending UDP data to a named host. The default asyncio eventloop allows it (and it probably shouldn't since sendto can block on the name lookup). Here is an example.

import uvloop


class P:
    def connection_made(self, transport):
        pass


async def go():
    loop = asyncio.get_event_loop()
    pair = await loop.create_datagram_endpoint(P, local_addr=("0.0.0.0", 6666))
    transport = pair[0]
    try:
        transport.sendto(b'foo', ("google.com", 6666))
    except Exception as ex:
        print(ex)

if 1:
    asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
asyncio.get_event_loop().run_until_complete(go())
@1st1
Copy link
Member

1st1 commented Nov 26, 2017

Good catch. I've fixed uvloop to raise an error when a DNS lookup is needed in .sendto(). I will fix asyncio in a similar fashion. The fix will be in the next uvloop release in a couple of days.

@1st1
Copy link
Member

1st1 commented Nov 27, 2017

Please try uvloop v0.9.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants