poggit / libasynql

Asynchronous MySQL access library for PocketMine plugins.
https://poggit.github.io/libasynql
Apache License 2.0
134 stars 44 forks source link

MySQL server has gone away #19

Closed Infernus101 closed 5 years ago

Infernus101 commented 5 years ago

Getting this error: SQL PREPARE error: MySQL server has gone away, for query SELECT Environment OS: Linux

SOF3 commented 5 years ago

Try the mysql-ping branch. I didn't test it, but it would fix the issue.

Infernus101 commented 5 years ago

okay, i am testing it, do you know what causes this? so i can reproduce it to test.

SOF3 commented 5 years ago

It happens if there are no queries for a long time (depending on your MySQL configuration).

An alternative way to fix this is to change your MySQL settings for connection timeout. But MySQL configuration is very annoying.

Infernus101 commented 5 years ago

True, also will it be a problem if too many players join at the same time and there are too many queries to run?

SOF3 commented 5 years ago

Usually, this only happens if there are too few queries. If this happens because of too many queries, perhaps some mechanism has identified your connection as a DoS and disconnected you, or the traffic is so high that it throttled, or some miscellaneous reasons. In these cases, it is not the responsibility of libasynql to fix.

Infernus101 commented 5 years ago

No i mean will it be a problem if all async workers are busy?

SOF3 commented 5 years ago

Each async worker has its own MySQL connection. Disconnections happen independently. In addition, libasynql has its own async pool, so it shouldn't be the case.