You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: yes
Does uvloop behave differently from vanilla asyncio? How?: not working
Hello. Currently, I am trying to work with aiosip project and it's working very well but unfortunately, it stops working after installing uvloop.
It looks like sendto do nothing and without any error. I can't see any UDP packet on any device.
File "uvloop/loop.pyx", line 2980, in create_datagram_endpoint
File "uvloop/handles/udp.pyx", line 86, in uvloop.loop.UDPTransport._connect
OSError: [Errno 106] Transport endpoint is already connected
in same time with classic eventloop I have no any problems.
importasyncioimportuvloopuvloop.install()
classUDP(asyncio.DatagramProtocol):
def__init__(self):
passdefconnection_lost(self, error):
print("connection_lost", error)
asyncdefmain():
loop=asyncio.get_event_loop()
transport, proto=awaitloop.create_datagram_endpoint(
lambda: UDP(),
local_addr=("192.168.1.9", 6001),
remote_addr=("192.168.1.3", 5060)
)
print("Before sending the message without a destination")
transport.sendto(b"deadbeef")
awaitasyncio.sleep(1)
print("After sending the message without a destination")
print("Before sending the message with a destination")
transport.sendto(b"deadbeef", ("192.168.1.3", 5060)) # will be connection lostawaitasyncio.sleep(1)
print("After sending the message with a destination")
asyncio.get_event_loop().run_until_complete(main())
looks like it happens if you trying to send a message with destination address and you have already specified it in create_datagram_endpoint as remote_addr. Without uvloop all working perfectly.
I wonder if uvloop is raising ValueError as it should?
EDIT My bad if the same remote address is used for create_datagram_endpoint and sendto it works with vanilla asyncio, so it should work with uvloop too.
Activity
stalkerg commentedon Mar 2, 2020
with uvloop 0.13.0 I have next error:
in same time with classic eventloop I have no any problems.
stalkerg commentedon Mar 2, 2020
ok, with version 0.12.2 everything working fine.
stalkerg commentedon Mar 2, 2020
after bisect I found this commit c2b65bc it's break UDP for aiosip (and I think not only).
1st1 commentedon Mar 4, 2020
Thanks for reporting this. Could you please write a functional test that would exhibit the bug?
stalkerg commentedon Mar 5, 2020
@1st1 yes, please
looks like it happens if you trying to send a message with destination address and you have already specified it in create_datagram_endpoint as remote_addr. Without uvloop all working perfectly.
jlaine commentedon Mar 5, 2020
You cannot both "connect" the endpoint to a remote address and use
sendto()with a destination address.This is the case in vanilla asyncio too:
https://github.com/python/cpython/blob/85cf1d514b84dc9a4bcb40e20a12e1d82ff19f20/Lib/asyncio/selector_events.py#L1028
I wonder if uvloop is raising
ValueErroras it should?EDIT My bad if the same remote address is used for
create_datagram_endpointandsendtoit works with vanilla asyncio, so it should work withuvlooptoo.Allow sendto the same addr if remote_addr is set
Allow sendto the same addr if remote_addr is set
Allow sendto the same addr if remote_addr is set