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

UDP "port unreachable" is not exposed #109

Closed
chrysn opened this issue Sep 15, 2017 · 2 comments
Closed

UDP "port unreachable" is not exposed #109

chrysn opened this issue Sep 15, 2017 · 2 comments

Comments

@chrysn
Copy link

chrysn commented Sep 15, 2017

  • uvloop version: 0.8.1
  • Python version: 3.5.4rc1
  • Platform: Debian GNU/Linux
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: yes

The example from issue #108, when run as ./echo.py 0 127.0.0.1 (running an example from the Python documentation in asyncio, which opens a UDP socket to an unserviced port and sends data) reports an OSError 111 "Connection refused", while when run as ./echo.py 1 127.0.0.1 (picking uvloop as the main loop), the network error is silently ignored.

Please make uvloop call error_received with some exception in those situations.

(This was already hinted at in #108, but I opened it as a separate issue so its resolution can be tracked by the workarounds for this just entering the aiocoap test suite).
[edit: missed the platform field]

chrysn added a commit to chrysn/aiocoap that referenced this issue Sep 15, 2017
1st1 added a commit that referenced this issue Nov 24, 2017
The new implementation follows asyncio pretty closely.  We no longer use
uv_udp_* functions from libuv.  Instead, we use uv_poll_* and inherit
asyncio logic from selector_events.py.

When `loop.create_datagram_endpoint()` is called with a `remote_addr`
argument, asyncio attempts to *connect* the socket.  The old uvloop
implementation didn't do that, as there's no 'uv_udp_connect()' function
in libuv (at least yet).

For UDP it doesn't really matter if the socket is connected or not.  The
main difference is that when a UDP socket is connected, we can use
`socket.send(data)` method, instead of `socket.sendto(data, addr)`.

The subtle difference appears in two scenarios:

* using getsockname();

* raising an exception from `create_datagram_endpoint()` when
  `remote_addr` is unreachable.

It doesn't seem practical to wait until we have `uv_udp_connect()`
function in libuv, hence the rewrite.

In the future, when `uv_udp_connect()` is available, it should be easy
to rollback to the current implementation.

Addresses issues #109, #108, #85.
@1st1
Copy link
Member

1st1 commented Nov 24, 2017

Should be fixed in master. Can you test if UDP works for you guys now?

@1st1
Copy link
Member

1st1 commented Nov 27, 2017

Please try uvloop v0.9.0, where this bug should be fixed.

@1st1 1st1 closed this as completed Nov 27, 2017
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