-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
getting could not load the system's DNS configuration, using synchronous, blocking fallback error #101
Comments
@raghuveer I've transferred your issue to the correct repository. The systems configuration is usually automatically detected and used. The warning appears if loading the configuration fails, but TBH doesn't currently indicate the reason for that. The fallback is using the native resolver, but it can't resolve DNS names non-blocking in that state, so it issues a warning. Could you have a look at the exception caught and provide that information here? dns/lib/Rfc1035StubResolver.php Line 249 in 299511d
A new release improving the warning seems appropriate. |
Please try with |
Thanks @kelunik, tried running amphp/dns package from dev-master as you suggested, my server setup: ran sample code from https://github.com/amphp/dns, ini_set('display_errors', 1); use Amp\Dns; Loop::run(function () {
}); Warning: Could not load the system's DNS configuration; falling back to synchronous, blocking resolver; Amp\Dns\ConfigException: Could not read configuration file '/etc/resolv.conf' (2) file_get_contents(): open_basedir restriction in effect. File(/etc/resolv.conf) is not within the allowed path(s): (/home/chat2/webapps/app-chat2:/var/lib/php/session:/tmp) in /home/chat2/webapps/app-chat2/public_html/amphp-dns/vendor/amphp/dns/lib/Rfc1035StubResolver.php on line 260 Fatal error: Uncaught Error: Call to undefined function pretty_print_records() in /home/chat2/webapps/app-chat2/public_html/amphp-dns/index.php:13 Stack trace: #0 [internal function]: {closure}() #1 /home/chat2/webapps/app-chat2/public_html/amphp-dns/vendor/amphp/amp/lib/Coroutine.php(118): Generator->send() #2 /home/chat2/webapps/app-chat2/public_html/amphp-dns/vendor/amphp/amp/lib/Success.php(41): Amp\Coroutine->Amp{closure}() #3 /home/chat2/webapps/app-chat2/public_html/amphp-dns/vendor/amphp/amp/lib/Internal/Placeholder.php(40): Amp\Success->onResolve() #4 /home/chat2/webapps/app-chat2/public_html/amphp-dns/vendor/amphp/amp/lib/Coroutine.php(151): Amp\Coroutine->onResolve() #5 /home/chat2/webapps/app-chat2/public_html/amphp-dns/vendor/amphp/amp/lib/Loop/Driver.php(126): Amp\Coroutine->__construct() #6 /home/chat2/webapps/app-chat2/public_html/amphp-dns/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick() #7 /home/chat2/webapps/app-chat2/public_html/amphp-dns/vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Dr in /home/chat2/webapps/app-chat2/public_html/amphp-dns/index.php on line 13 is there any way we can access /etc/resolv.conf file without disabling open_basedir restrictions? or alternatively, can we define native resolver, as you shared earlier locally as manual config? that other amphp\socket library uses, that inturn is used by amphp/mysql library, that I am using in my application? please share your inputs, thank you |
is there any alternative solution for amphp/dns to access /etc/resolv.conf without disabling open_basedir restrictions? I did try the example at https://github.com/amphp/dns/blob/master/examples/custom-config.php, by providing a numeric index array of hostnames,
With google offered recursive dns servers being used in the custom config, I see available list of IPv4 and IPv6 addresses in the result, for whichever hostname is given in the input, I would like to know about how this custom config be consumed by all dependencies of amphp/mysql library like amphp/socket (that uses amphp/dns library)? or is there a way for us to define this recursive DNS Servers info as custom config of Amphp/dns library, when using amphp/mysql library in our application? your inputs and support will be really helpful, thank you |
@raghuveer You've found the correct example. |
Thanks a lot @kelunik it worked, I will try including this in my application :) |
What are the suggested number of attempts? the number in the sample code is 3. I did try adding more recursive DNS Servers (like 2 IPv4 Addresses of opendns.com), to the existing Google Recursive DNS Server IPv4 Address (8.8.8.8) and some IPv6 Address `$customConfigLoader = new class implements Dns\ConfigLoader {
}; Dns\resolver(new Dns\Rfc1035StubResolver(null, $customConfigLoader)); is this ok? please share your inputs, thank you |
That depends on your needs on speed and reliability. I think 2 or 3 are the default. The total timeout will be attempt * timeout I think. |
I am using the defaults as per your example, thank you @kelunik |
I am getting the following error when error reporting is turned on, irrespective of whether the db query is insert/update/select/delete, even though the expected operation is happening,
Warning: Could not load the system's DNS configuration, using synchronous, blocking fallback in /home/chat2/webapps/app-chat2/public_html/easeampmysqlredis/vendor/amphp/dns/lib/Rfc1035StubResolver.php on line 252
The php code is being run on ubuntu linux server and with php 7.4. Do we need to explicitly define dns resolver ip addresses (either google or opendns etc...), to fix this error? if yes, I would request you to please suggest with a code sample.
thank you
The text was updated successfully, but these errors were encountered: