facebookarchive/doh-proxy

[httpproxy] Exception in callback _SelectorDatagramTransport._read_ready()

Closed this issue · 3 comments

setup as described in https://facebookexperimental.github.io/doh-proxy/tutorials/nginx-dohhttpproxy-unbound-centos7.html but on Debian

running from git 149c97d
Python 3.5.3

The setup works but the logs contain many occurrences of:

ERROR: Exception in callback _SelectorDatagramTransport._read_ready()
handle: <Handle _SelectorDatagramTransport._read_ready()>
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run
    self._callback(*self._args)
  File "/usr/lib/python3.5/asyncio/selector_events.py", line 1077, in _read_ready
    self._protocol.datagram_received(data, addr)
  File "/usr/local/lib/python3.5/dist-packages/dohproxy/server_protocol.py", line 139, in datagram_received
    self.receive_helper(dnsr)
  File "/usr/local/lib/python3.5/dist-packages/dohproxy/server_protocol.py", line 128, in receive_helper
    self.fut.set_result(dnsr)
  File "/usr/lib/python3.5/asyncio/futures.py", line 348, in set_result
    raise InvalidStateError('{}: {!r}'.format(self._state, self))
asyncio.futures.InvalidStateError: CANCELLED: <Future cancelled>

The error is happening because the future we are trying to set the result for is already cancelled. I don’t have access to a computer now, so I did not check the sources, but most likely this is due to a query that already timeouted. We eventually get the result later from the dns server, call in the callback and try to set result on the future, but this was already cancelled.

Sent with GitHawk

This should be fixed with #59

v0.0.9, which contains the fix, was pushed to pip