phergie / phergie-irc-client-react

IRC client library built on React
BSD 3-Clause "New" or "Revised" License
56 stars 26 forks source link

DNS query error: too many retries #59

Closed radonthetyrant closed 7 years ago

radonthetyrant commented 7 years ago
$connection = new Connection();
        $connection
            ->setServerHostname("irc.quakenet.org")
            ->setServerPort(6667)
            ->setNickname("test01010101010")
            ->setUsername("test10101010101")
            ->setOption('allow-self-signed', true)
        ;
        if ($this->config["ssl"])
            $connection->setOption('transport', 'ssl');

        $client = new Client();

        $client->on('irc.received', function ($message, $write, $conn, $logger) use ($io) {
            dump($message);
        });

        $client->run($connection);

leads to: 2017-03-05 15:32:24 ERROR DNS query for irc.quakenet.org failed: too many retries []

Is this an issue on my end?

elazar commented 7 years ago

I believe so, as I'm not able to replicate it. I'd suggest using a DNS server other than the default (i.e. 8.8.8.8, a Google DNS server), such as some of these other free DNS servers. You can use the setDnsServer() method of the Client instance to do this.

I did notice a few other things in the process of trying to replicate your issue, though.

  1. On my local system, so long as the transport is set to 'ssl', the test script seems to die because, in Client->addSecureConnection(), the then() callback isn't being executed. I'm not sure why this is. @WyriHaximus may be able to provide more insight here.

  2. You are not calling setHostname(), setServername(), or setRealname() on your Connection instance. These are necessary for the USER command to succeed when registering your connection. If they are not included, you can receive an error from the server resembling the following:

2017-03-05 15:48:46 DEBUG test01010101010!test10101010101@irc.quakenet.org USER test10101010101 0 :* []
...
2017-03-05 15:48:46 DEBUG test01010101010!test10101010101@irc.quakenet.org :portlane.se.quakenet.org 461 * USER :Not enough parameters []
array(8) {
  ["prefix"]=>
  string(25) ":portlane.se.quakenet.org"
  ["servername"]=>
  string(24) "portlane.se.quakenet.org"
  ["command"]=>
  string(3) "461"
  ["params"]=>
  array(5) {
    [1]=>
    string(4) "USER"
    [2]=>
    string(21) "Not enough parameters"
    ["iterable"]=>
    array(1) {
      [0]=>
      string(4) "USER"
    }
    ["tail"]=>
    string(21) "Not enough parameters"
    ["all"]=>
    string(27) "USER :Not enough parameters"
  }
  ["message"]=>
  string(61) ":portlane.se.quakenet.org 461 * USER :Not enough parameters
"
  ["code"]=>
  string(18) "ERR_NEEDMOREPARAMS"
  ["target"]=>
  string(1) "*"
  ["tail"]=>
  string(18) "PING :1991449620
"
}
  1. QuakeNet in particular seems to require more in the way of identification / registration than just USER and NICK commands. See the console output below. The network documentation on IDENT and Trusts and AUTH may be helpful.
2017-03-05 15:48:54 DEBUG test01010101010!test10101010101@irc.quakenet.org NOTICE AUTH :*** No ident response []
array(4) {
  ["command"]=>
  string(6) "NOTICE"
  ["params"]=>
  array(3) {
    ["all"]=>
    string(27) "AUTH :*** No ident response"
    ["nickname"]=>
    string(4) "AUTH"
    ["text"]=>
    string(21) "*** No ident response"
  }
  ["message"]=>
  string(36) "NOTICE AUTH :*** No ident response
"
  ["targets"]=>
  array(1) {
    [0]=>
    string(4) "AUTH"
  }
}
2017-03-05 15:50:15 DEBUG test01010101010!test10101010101@irc.quakenet.org ERROR :Closing Link: test01010101010 by portlane.se.quakenet.org (Registration Timeout) []
array(3) {
  ["command"]=>
  string(5) "ERROR"
  ["params"]=>
  array(2) {
    ["all"]=>
    string(81) ":Closing Link: test01010101010 by portlane.se.quakenet.org (Registration Timeout)"
    ["message"]=>
    string(80) "Closing Link: test01010101010 by portlane.se.quakenet.org (Registration Timeout)"
  }
  ["message"]=>
  string(89) "ERROR :Closing Link: test01010101010 by portlane.se.quakenet.org (Registration Timeout)
"
}
WyriHaximus commented 7 years ago

@radonthetyrant are you on windows 10 or server 2012? If so we're working on it: https://github.com/reactphp/dns/issues/44

elazar commented 7 years ago

That could explain it. I'm using OS X, so that issue wouldn't affect me.

radonthetyrant commented 7 years ago

hello,

@WyriHaximus yes indeed, i used this on a windows 8.1 machine with php7.1 because it's easier for me to test the scripts on win before moving them to linux. I use 8.8.8.8 all the time btw.

@elazar thanks for the detailed response. I tried to get the script to connect at all, so a working user command is secondary for now. The ssl was turned off tho, since 6667 is the default non-ssl port.

since it seems to be related to reactphp, i guess this issue can be closed.

WyriHaximus commented 7 years ago

@radonthetyrant tested it locally with a resolver of in my local network and with Google's resolver. The issue doesn't persists in Google's but with Windows.