reactphp / socket

Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP.

Home Page:https://reactphp.org/socket/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with DNS request in socket connector

mr-older opened this issue · comments

Error while creating DNS Query
$query = new Query($domain, $type, Message::CLASS_IN);)

in
resolveAll($domain, $type),

construct doesn`t happen:
Argument 1 passed to React\Socket\TimeoutConnector::React\Socket{closure}() must be an instance of Exception, instance of Error given, called in /../promise-master/src/Internal/RejectedPromise.php on line 33

$loop = React\EventLoop\Factory::create();
$client_socket = new React\Socket\Connector($loop);

$client_socket->connect('google.com:443')->then(function(React\Socket\ConnectionInterface $connector) {
	},
	function(Throwable $error) {
		echo $error->getMessage();
	}
);

Everything is running normally using ip instead of domain name.

PHP 7.3.27 on debian 10.8,
event-loop 1.1.1 (2020-01-01),
promise 3.0.0 (xxxx-xx-xx),
dns 1.5.0 (2021-03-05),
socket 1.6.0 (2020-08-28),
cache 1.1.0 (2020-09-18),
evenement v3.0.1 (2017-07-23)

The same is true for promise 2.8.0 (2020-05-12) with the following:

google.com:443: Argument 1 passed to React\Socket\TimeoutConnector::React\Socket{closure}() must be an instance of Exception, instance of Error given, called in /.../react/promise-master/src/RejectedPromise.php on line 28

Am I doing something wrong?

This error I've got after upgrading from older versions. No changes in my code and still can`t figure out, what exactly could be missed.

@mr-older Thank you for reporting, this definitely shouldn't have happened!

We're not aware of any such issues and I can not reproduce the problem you're seeing locally. Can you provide a gist for me to reproduce?

Also, the paths in your exception output seem kind of strange, did you perhaps manually patch your installation? If not, can you try reinstalling and provide your composer.lock along with your gist?

Thank you very much for the answer. I'm not using composer, cause this library is the only one that my project needs. Without composer the project is much lighter and starts faster. Heavy responsibility is also a great reason of minimal using of third-party code: I have to be responsible for using your code, as it were mine.

The misorder of included files in react/dns module was the problem and it was easily resolved by analyzing of "use" sections of your files, thanks a lot!