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

TCP - asyncio.exceptions.IncompleteReadError #31

Closed
powellnorma opened this issue Apr 6, 2024 · 3 comments
Closed

TCP - asyncio.exceptions.IncompleteReadError #31

powellnorma opened this issue Apr 6, 2024 · 3 comments
Assignees

Comments

@powellnorma
Copy link

Any idea what the cause of this might be? Seems to happen randomly every now-and-then ..

[..]
    res, cached = await resolver.query(domain, record_type)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/async_dns/resolver/base_resolver.py", line 64, in query
    return await asyncio.wait_for(self._query(fqdn, qtype),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/asyncio/tasks.py", line 489, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/async_dns/resolver/util.py", line 23, in wrapped
    return await future
           ^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/async_dns/resolver/proxy_resolver.py", line 92, in _query
    res = await self.request(fqdn, qtype, addr)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/async_dns/resolver/base_resolver.py", line 70, in request
    result = await self.client.query(fqdn, qtype, addr)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/async_dns/resolver/client.py", line 35, in query
    return await task
           ^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/async_dns/resolver/client.py", line 42, in _query
    res = await asyncio.wait_for(self._request(req, addr), self.timeout)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/asyncio/tasks.py", line 489, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/async_dns/resolver/client.py", line 51, in _request
    data = await request(req, addr, self.timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/async_dns/request/tcp.py", line 32, in request
    result = await asyncio.wait_for(_request(req, addr), timeout)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/asyncio/tasks.py", line 489, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/async_dns/request/tcp.py", line 22, in _request
    size, = struct.unpack('!H', await reader.readexactly(2))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/asyncio/streams.py", line 730, in readexactly
    raise exceptions.IncompleteReadError(incomplete, n)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes
@gera2ld
Copy link
Owner

gera2ld commented Apr 7, 2024

I think it's just some random network issue and you just need to retry.

@powellnorma
Copy link
Author

Maybe it would make sense if this "retry logic" gets added to the library? Normally TCP has "retry-logic" builtin, I think its weird this is happening (I used 1.1.1.1 as DNS Server)

@gera2ld
Copy link
Owner

gera2ld commented Apr 9, 2024

Yes, reasonable since we already use a connection pool.

@gera2ld gera2ld self-assigned this Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants