amphp / mysql

An async MySQL client for PHP, optimizing database interactions with efficient non-blocking capabilities. Perfect for responsive, high-performance applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Randomly "Connection closed unexpectedly" Exception

xpader opened this issue · comments

commented

The mysql client randomly throw " Amp\Sql\ConnectionException: Connection closed unexpectedly",my MySQL Server is very stable when using mysqlnd or connect with Java, The exception throw from couple minutes or about half hours.

MySQL timeout settings:

Variable_name Value
connect_timeout 10
delayed_insert_timeout 300
innodb_lock_wait_timeout 60
innodb_rollback_on_timeout OFF
interactive_timeout 60
lock_wait_timeout 31536000
net_read_timeout 30
net_write_timeout 60
slave_net_timeout 3600
wait_timeout 60

amphp/mysql pool max idle time I have tried: 10, 30, 60, 120, all have this problem..

Same problem here... =[

Could you please write a simple script reproducing the issue?

commented

It's just normal use, and the issue only happens probabilistically.
I used in my framework: https://github.com/xpader/workerman-amphp-framework/blob/master/src/framework/Db/Connection.php like fetchOne() and fetchAll()
And any query may have this problem..

commented

There's an interest thing today.
One of our MySQL server is slow respond and almost gone, the simple primary key query running about 300 seconds and more, and there's lots of table lock on very simple query.. The MySQL server has running about ten years, and we restart it..
After that, "Connection closed unexpectedly" is never show so far..

So, I think the problem is not amphp/mysql, it's out server's problem..