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

Wrong answer for DNS queries after an internet outage #203

Open
mberdyshev opened this issue Oct 10, 2024 · 3 comments
Open

Wrong answer for DNS queries after an internet outage #203

mberdyshev opened this issue Oct 10, 2024 · 3 comments

Comments

@mberdyshev
Copy link

mberdyshev commented Oct 10, 2024

My application works in a Windows environment where internet dropouts may happen. If the app makes a DNS query at such a moment, it can't get the answer even when the connection has been re-established.
Let's look at an example - I've taken the code from the repository __main__.py file and have changed only two last lines to make a cycle:

while True:
    channel.query(hostname, query_type, cb)
    wait_channel(channel)
    time.sleep(1)

For imitations of a network outage, I apply the following command (Windows):

netsh wlan add filter permission=block ssid="<Wi-Fi ssid>" networktype=infrastructure

After running the changed __main__.py I get: Error: (11) Could not contact DNS servers. Even after the network establishment (or filter removal via netsh wlan delete filter <...>) during the working script, I still receive the same error message with no successful answer. Only a full script re-run helps in this situation.

I'm not sure whether this issue lies inside c-ares or not, as I wasn't able to make it run on Windows, but presumably you may know better.

@saghul
Copy link
Owner

saghul commented Oct 10, 2024

I honestly have no idea 😅

@mberdyshev
Copy link
Author

Could you take the time to investigate the problem?

@saghul
Copy link
Owner

saghul commented Oct 11, 2024

I don't have time, now, sorry. The solution proposed in aio-libs/aiodns#124 is correct though, so adding the extra required API to pycares is acceptable. Feel free to send a PR, or I'll get to it when I have time.

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