Skip to content

Sync initial connection can cause *very* long waits #60

@JaxkDev

Description

@JaxkDev

Describe the bug
During initial construction of the libasynql if you have a internet connection issue or DB issue you can expect waits of up to 3 minutes PER plugin that uses libasynql.

Sample code

$this->db = libasynql::create($plugin, @yaml_parse_file($plugin->getDataFolder()."mysql.yml"), [
	"sqlite" => "sqlite.sql",
	"mysql" => "mysql.sql"
]);

Expected behavior
Smaller timeout or connection made async (not sure how its done backend)

Environment
OS: Windows 10
PocketMine version: 3.19.0
PHP: 8.0.3

Log

[17:22:26] [Server thread/INFO]: Loading FusionCore v1.0.0
[17:22:26] [Asynchronous Worker #0 thread/DEBUG]: Set memory limit to 256 MB
status
[17:24:49] [Server thread/CRITICAL]: FusionCraft\Core\vendor9a5a9370\poggit\libasynql\SqlError: "SQL CONNECT error: MySQL server has gone away" (EXCEPTION) in "plugins/FusionCore.phar/src/FusionCraft/Core/vendor9a5a9370/p
oggit/libasynql/libasynql" at line 141
[17:24:49] [Server thread/CRITICAL]: #0 plugins/FusionCore.phar/src/FusionCraft/Core/SharedDatabase(29): FusionCraft\Core\vendor9a5a9370\poggit\libasynql\libasynql::create(string[31] object(FusionCraft\Core\Plugin), array
[4], array[2])
[17:24:49] [Server thread/CRITICAL]: #1 plugins/FusionCore.phar/src/FusionCraft/Core/Plugin(24): FusionCraft\Core\SharedDatabase->__construct(string[31] object(FusionCraft\Core\Plugin))
[17:24:49] [Server thread/CRITICAL]: #2 pmsrc/src/pocketmine/plugin/PluginManager(182): FusionCraft\Core\Plugin->onLoad()
[17:24:49] [Server thread/CRITICAL]: #3 pmsrc/src/pocketmine/plugin/PluginManager(346): pocketmine\plugin\PluginManager->loadPlugin(string[81] C:\Users\Jack\Documents\PocketMine\FusionCraft-PMMP3-PHP8\plugins\FusionCore.p
ha, array[2])
[17:24:49] [Server thread/CRITICAL]: #4 pmsrc/src/pocketmine/Server(1529): pocketmine\plugin\PluginManager->loadPlugins(string[66] C:\Users\Jack\Documents\PocketMine\FusionCraft-PMMP3-PHP8\plugins\)
[17:24:49] [Server thread/CRITICAL]: #5 pmsrc/src/pocketmine/PocketMine(291): pocketmine\Server->__construct(string[23] object(BaseClassLoader), string[35] object(pocketmine\utils\MainLogger), string[58] C:\Users\Jack\Doc
uments\PocketMine\FusionCraft-PMMP3-PHP8\, string[66] C:\Users\Jack\Documents\PocketMine\FusionCraft-PMMP3-PHP8\plugins\)
[17:24:49] [Server thread/CRITICAL]: #6 pmsrc/src/pocketmine/PocketMine(321): pocketmine\server()
[17:24:49] [Server thread/CRITICAL]: #7 pmsrc(11): require(string[113] phar://C:/Users/Jack/Documents/PocketMine/FusionCraft-PMMP3-PHP8/PocketMine-MP.p)
[17:24:49] [Server thread/CRITICAL]: Could not load plugin 'FusionCore'

Take note of timestamps, if several plugins were to have libasynql and they all failed like above during initial connection that could be an extremely long wait before the user can interact with the server (stop command etc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions