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

ErrCode: 6, Reason: 'Could not resolve host: www.amazon.com' #257

Open
BhardwajAnshul opened this issue Feb 26, 2024 · 10 comments
Open

ErrCode: 6, Reason: 'Could not resolve host: www.amazon.com' #257

BhardwajAnshul opened this issue Feb 26, 2024 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@BhardwajAnshul
Copy link

Failed to perform, ErrCode: 6, Reason: 'Could not resolve host: www.amazon.com'. This may be a libcurl error, See https://curl.se/libcurl/c/libcurl-errors.html first for more details.

@BhardwajAnshul BhardwajAnshul added the bug Something isn't working label Feb 26, 2024
@yifeikong
Copy link
Owner

It seems to be DNS issue. Does it work on other network connections?

@yifeikong yifeikong changed the title I am getting this error a lot ErrCode: 6, Reason: 'Could not resolve host: www.amazon.com' Feb 26, 2024
@BhardwajAnshul
Copy link
Author

BhardwajAnshul commented Feb 26, 2024

The issue appears to be transient, as it previously functioned correctly on the same network. Initially, the system was capable of resolving DNS problems after several attempts. I have implemented a routine in my script to reboot the router and renew the IP address. However, the problem has become more frequent following router restarts. Despite rebuilding the session post-restart, the issue persists.

@yifeikong
Copy link
Owner

yifeikong commented Feb 26, 2024

Does it start to work immediately once you restart the curl_cffi script?

@BhardwajAnshul
Copy link
Author

If i run the script again, it does work i think. It doesnt work only when i restart the router without stopping the script.

@yifeikong
Copy link
Owner

I see, you were restarting your router so that the ISP will assign you a new IP, but then the scripts you are running are unhappy with the expected network downtime and stops working even after the network is back on.

Apprently, there are some caching mechanism for DNS server address and resolutions, which should be the root cause.

My suggestion is that either you restart the script after you restart the router, or you can set your DNS to a server like 8.8.8.8 instead of the default DNS server.

@BhardwajAnshul
Copy link
Author

image

Could the "Operation timed out" warning be related to the issue I'm experiencing? I've also noticed this warning appears shortly before the problem occurs.

@BhardwajAnshul
Copy link
Author

Restarting the script is not a viable solution, as it is designed to run continuously for days without interruption. I cannot be present to manually restart the script each time this error occurs.

@yifeikong
Copy link
Owner

If you were restarting the router, of course the request will be timed out.

Does setting another DNS work?

@BhardwajAnshul
Copy link
Author

The timeout errors are not related to restarting the router. Once a timeout error occurs, subsequent requests continue to experience this error as well. Typically, these errors are resolved automatically after several attempts, but lately, they have been persistent and continuous.

Failed to perform, ErrCode: 28, Reason: 'Operation timed out after 10006 milliseconds with 0 bytes received'. This may be a libcurl error, See https://curl.se/libcurl/c/libcurl-errors.html first for more details.

The above error was for a request that timed out without receiving a single byte.

And is there a way to set DNS in curl_cffi?

@yifeikong
Copy link
Owner

You should set your DNS on the OS level. For Linux, it's something like /etc/resolv.conf, for macOS and Windows, you can do this via the GUI interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants