Skip to content

Can't UDP sendto named host #91

Closed
Closed
@richardkiss

Description

@richardkiss
  • 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())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions