-
Notifications
You must be signed in to change notification settings - Fork 69
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
Could not contact DNS servers
after a connection outage and re-establishment
#124
Comments
The channel is probably being initialized with no nameservers, and then the connection comes online the nameservers are populated, but the channel isn't being recreated |
When the system config changes, https://c-ares.org/docs/ares_reinit.html needs to be called on the channel |
To fix this
Then you need to call that method when the network changes |
Is there a possibility this can be done automatically? Seems like a bit of an issue if we expect every developer to implement this themselves in order to have a robust application. |
Not sure how TBH. THat's a question for the c-ares project likely... |
Every operating system is different on how it knows the network has changed. I'm not aware of any python library that can abstract that away and watch for network changes on all or even most systems |
I changed the example from the repository description to provide infinite query retries until a successful answer:
Let's assume my Windows machine has some network problems before the script run - I mockup this with the following cmd command:
When the script starts it constantly outputs
(11, 'Could not contact DNS servers')
as expected. But even if the network connection is re-established (netsh wlan delete filter <...>
) during the script run, it still outputs the error. I can get the answer only if I stop and rerun the script.I have also opened the issue on
pycares
tracker - saghul/pycares#203 .The text was updated successfully, but these errors were encountered: