amphp / dns

Async DNS resolution for PHP based on Amp.
https://amphp.org/dns
MIT License
157 stars 32 forks source link

Amazon MySql db connection issue #76

Closed plankes-projects closed 6 years ago

plankes-projects commented 6 years ago

I am connecting to an amazon DB from windows php 7.2.4 with following code: https://gist.github.com/plankes-projects/d941f49bf74353f0b29700261192c639

I get DNS timeout exception when I am running it on my windows developer machine. https://gist.github.com/plankes-projects/c3cfd2a6aead806adc7a9efaf545ba48

Everthing works fine if I am using this config with eloquent or if I am connecting to a local DB: https://gist.github.com/plankes-projects/afbe1d66eb08262a0f1484cf9fbaf402

Following amphp versions are installed with composer: amphp/amp dev-master 9b2fb76 A non-blocking concurrency framework for PHP applications. amphp/byte-stream v1.3.1 A stream abstraction to make working with non-blocking I/O... amphp/cache v1.2.0 A promise-aware caching API for Amp. amphp/dns v0.9.12 Async DNS resolution for Amp. amphp/file v0.3.1 Allows non-blocking access to the filesystem for Amp. amphp/mysql dev-master aec58f4 Asynchronous parallel Mysql client built on the Amp concur... amphp/parallel v0.2.5 Parallel processing component for Amp. amphp/parser v1.0.0 A generator parser to make streaming parsers simple. amphp/process v0.3.3 Asynchronous process manager. amphp/socket v0.10.8 Async socket connection / server tools for Amp. amphp/sync v1.0.1 Mutex, Semaphore, and other synchronization tools for Amp. amphp/uri v0.1.3 Uri Parser and Resolver. amphp/windows-registry v0.3.1 Windows Registry Reader.

Moved from https://github.com/amphp/mysql/issues/67

kelunik commented 6 years ago

Could you please check which DNS server the requests are sent to and whether that's the right one?

plankes-projects commented 6 years ago

They were send to the local router, same as the other one. But this issue is not relevant anymore If no one else has it.

I decided to go for real threading in a docker container instead of Amphp.

Good luck to you guys!

kelunik commented 6 years ago

It would still be good to know the root cause, but if you no longer care, you probably don't want to invest some time to help us?

plankes-projects commented 6 years ago

I am sorry, I wasted a lot of time during the last weeks because amphp/mysql has also a bug which results in losing data without throwing an exception, creating too many connections, and constantly losing data if query count > pool size.

I did not find the cause for this, sorry =( (https://github.com/friends-of-reactphp/mysql has similar problems, so maybe it is a php issue)

But thats the reason why I moved to the pthreads approach which works fine at the moment.

kelunik commented 6 years ago

Could you share the script you used for testing?

plankes-projects commented 6 years ago

Yes, I can do that. I extracted the relevant parts, but you will have to adapt it a little bit to make it run.

https://gist.github.com/plankes-projects/e71a05d86defa03c9ac0eca0842e5fa7

I think most interesting will be funciton performAsync.

plankes-projects commented 6 years ago

One more thing, I did not recognize any patterns. Sometimes stuff fails sometimes not. And the occurrence of issues 'feels' different on ubuntu OS.