Skip to content

Windows Error: DNS query for google.com failed: too many retries #44

Closed

Description

@internalsystemerror

The code used is (using v0.4.3):

<?php
// dns.php
error_reporting(PHP_INT_MAX);

require_once 'vendor/autoload.php';

$loop = \React\EventLoop\Factory::create();
$factory = new \React\Dns\Resolver\Factory();
$dns = $factory->create('8.8.8.8', $loop);

$dns->resolve($argv[1])
    ->then(
        function ($ip) { echo "Host: $ip\n"; },
        function ($e) { echo "Error: {$e->getMessage()}\n"; }
);

$loop->run();

The command:

php dns.php google.com

The error:

Error: DNS query for google.com failed: too many retries

Is there any way I can debug this further to find out what's causing this? The same code on my linux box works just fine...

Activity

  1. clue commented on Jan 23, 2017

    @clue
    Member

    Thanks for reporting!

    What Windows version are you using?
    Does the test suite yield any errors?

    Perhaps you can try patching the Executor class and raise the timeout value and/or patch the RetryExecutor and patch the number of retries?

  2. WyriHaximus commented on Jan 23, 2017

    @WyriHaximus
    Member

    Seeing the same error on my windows 10 gaming desktop. One test fails:

    There was 1 failure:
    
    1) React\Tests\Dns\FunctionalTest::testResolveGoogleResolves
    Expectation failed for method name is equal to <string:__invoke> when invoked 1 time(s).
    Method was expected to be called 1 times, actually called 0 times.
    

    I'll make a PR with AppVeyor configuration, @clue or @cboden could you setup AppVeyor for this repository?

  3. internalsystemerror commented on Jan 23, 2017

    @internalsystemerror
    Author

    Windows 10 + updates (not sure the exact build anymore, it changes without me knowing these days) ... I'll run the test suites when I get back... I'm sure it's probably related to php configuration on windows... One thing I did try already was increasing the timeout and retries, with same result

  4. internalsystemerror commented on Jan 23, 2017

    @internalsystemerror
    Author

    Confirming that running the testsuite on windows gives the error quoted by @WyriHaximus.

  5. davidcole1340 commented on Jan 27, 2017

    @davidcole1340

    Windows 10 users of a library I develop are also experiencing this problem, I haven't been able to test as I don't have a Windows 10 machine.

  6. kassmed commented on Feb 3, 2017

    @kassmed

    I have the same issue on windows server 2008 R2, but that is w7 basically, not w10. Any solution?

  7. MrPh1l commented on Feb 7, 2017

    @MrPh1l

    Anyone found a temporary way of bypassing this bug?

  8. WyriHaximus commented on Feb 7, 2017

    @WyriHaximus
    Member

    Anyone found a temporary way of bypassing this bug?

    Will try and look into it tonight when I don't forget. Something you could try in the mean time is using your local DNS server (most likely your router) instead of the Google's DNS server (8.8.8.8 and 8.8.4.4) or try a different open DNS service like OpenDNS (208.67.222.222 and 208.67.220.220)

  9. kassmed commented on Feb 7, 2017

    @kassmed

    @WyriHaximus Already tried workarounds like that. Doesn't help. It seems to be a problem only on windows though. Setting in system DNS servers, hardcoding DNS servers or even manually inserting the resolved IP in the hosts file does not help the problem.

  10. WyriHaximus commented on Feb 7, 2017

    @WyriHaximus
    Member

    @kassmed Bonkers does UDP work at all on windows? You could use https://github.com/reactphp/datagram/tree/master/examples to test that

  11. kassmed commented on Feb 7, 2017

    @kassmed

    @WyriHaximus Seems to work fine on localhost, but externally i get the same error. Here is a picture of both runs:
    https://gyazo.com/67987ed351262a4aaf505130f38a8e76

  12. WyriHaximus commented on Feb 7, 2017

    @WyriHaximus
    Member

    @kassmed don't let datagram do the DNS look up, provide it an IP instead of a hostname to work around that

  13. kassmed commented on Feb 7, 2017

    @kassmed

    @WyriHaximus Well now i can make my websocket connect, but now i just have the problem that the CN does not match the certificate when using wss, so the connection handshake fails.

  14. kassmed commented on Feb 7, 2017

    @kassmed

    @WyriHaximus I managed to make a REALLY dodgy bypass. In react\socket-client\src\SecureConnector.php i found the line:
    'peer_name' => $host

    Here i just hardcoded the hostname of what i wanted to connect to, but let the socket connect to the IP directly without DNS lookup.

  15. kassmed commented on Feb 7, 2017

    @kassmed

    @WyriHaximus Well, that fix turned out to not work 100% for me, but it might help someone else.

  16. 2 remaining items

  17. Jimmy062006 commented on Feb 11, 2017

    @Jimmy062006

    No idea if this helps at all.

    http://pastebin.com/ZKFaPauu

  18. Jimmy062006 commented on Feb 12, 2017

    @Jimmy062006

    Does the request look like its formatted correctly in my pastebin ?

  19. micksam7 commented on Feb 13, 2017

    @micksam7

    This appears to be a problem with how PHP handles UDP streams when stream_get_contents is called with a maxlength set, specifically on windows systems. I submitted a php bug report about this here: https://bugs.php.net/bug.php?id=74090

    A fix is to change public $bufferSize = 65536 to $bufferSize = null in react/stream/src/Stream.php

  20. clue commented on Feb 13, 2017

    @clue
    Member

    Thanks for digging into this @micksam7! 👍

    Does anybody feel like filing a PR to fix this for this component in the meantime? :shipit:

    Also, this should ultimately be fixed via #12 instead.

  21. Jimmy062006 commented on Feb 13, 2017

    @Jimmy062006

    Testing buffersize fix on a windows machine now.

    EDIT:

    This works fine, I'll try and get a PR done when I'm awake for you if its not happened all ready.

  22. Jimmy062006 commented on Feb 14, 2017

    @Jimmy062006
  23. internalsystemerror commented on Feb 14, 2017

    @internalsystemerror
    Author

    @micksam7 Thank you! Been struggling to figure that out, I guess I just assume PHP works flawlessly :/
    @Jimmy062006 Thanks for the fix also!

  24. TheMeq commented on Mar 2, 2017

    @TheMeq

    Note: Issue also affects Windows Server 2012 R2.

  25. clue commented on Mar 9, 2017

    @clue
    Member

    Closed via #53

  26. added this to the v0.4.6 milestone on Mar 9, 2017
  27. ScorpioKC commented on Feb 20, 2018

    @ScorpioKC

    I'm having the very same problem on my phone.Operating system is Android 7.0

  28. clue commented on Feb 20, 2018

    @clue
    Member

    @ScorpioKC We're not aware of any issues currently. Can you give some instructions on how to reproduce the problem you're seeing? Also, output of php -v and composer info would help 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions