poggit / libasynql

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

Added missing parent::quit() in SqlSlaveThread. #44

Closed larryTheCoder closed 4 years ago

larryTheCoder commented 4 years ago

This method is required in order to know that the thread has successfully being destroyed. Without this, pocketmine would think that the thread is still running and finally causing a heap of unknown/killed threads.

Steps to reproduce

Here is an example of how to create the such issue stated above.

for($i = 0; $i <= 5; $i++){
    $db = libasynql::create($this, [
        "type"   => "sqlite",
        "sqlite" => "data.db",
    ], [
        "sqlite" => "temp.sql",
    ]);

    $db->executeGeneric("dummy");
    $db->waitAll();
    $db->close();
}

foreach(ThreadManager::getInstance()->getAll() as $worker){
    var_dump($worker->getThreadName());
}

Another way to reproduce this issue is to reload the server multiple times and issue a status command

Results:

Before this commit: unknown After this commit: unknown