Thread crashing instead of returning errors.
Xd-pro opened this issue · 10 comments
Describe the bug
Stack trace:
#0 [internal function]: pocketmine\errorhandler\ErrorToExceptionHandler::handle(2, 'SQLite3Stmt::ex...', 'D:\\projects\\poc...', 89)
#1 D:\projects\pocketmine-dev-env-new\virions\libasynql\src\poggit\libasynql\sqlite3\Sqlite3Thread.php(89): SQLite3Stmt->execute()
#2 D:\projects\pocketmine-dev-env-new\virions\libasynql\src\poggit\libasynql\base\SqlSlaveThread.php(88): poggit\libasynql\sqlite3\Sqlite3Thread->executeQuery(Object(SQLite3), 2, 'INSERT\nINTO pla...', Array)
#3 phar://D:/projects/pocketmine-dev-env-new/PocketMine-MP.phar/src/thread/CommonThreadPartsTrait.php(93): poggit\libasynql\base\SqlSlaveThread->onRun()
#4 [internal function]: pocketmine\thread\Thread->run()
#5 {main}
thrown in D:\projects\pocketmine-dev-env-new\virions\libasynql\src\poggit\libasynql\sqlite3\Sqlite3Thread.php on line 89
Sample code
Query:
INSERT
INTO players (xuid, ip)
VALUES (:xuid, :ip)
Table:
CREATE TABLE IF NOT EXISTS players (
xuid VARCHAR(255) NOT NULL PRIMARY KEY ON CONFLICT ABORT,
ip VARCHAR(255) NOT NULL,
permBanned BOOLEAN NOT NULL DEFAULT FALSE,
unbanAt INT NOT NULL DEFAULT 0,
warns INT NOT NULL DEFAULT 0
)
Expected behavior
Errors would be returned in the onError function.
Environment
OS: Windows
PocketMine version: 4.7.0 / 1.19.20
Describe the bug
Stack trace: #0 [internal function]: pocketmine\errorhandler\ErrorToExceptionHandler::handle(2, 'SQLite3Stmt::ex...', 'D:\\projects\\poc...', 89) #1 D:\projects\pocketmine-dev-env-new\virions\libasynql\src\poggit\libasynql\sqlite3\Sqlite3Thread.php(89): SQLite3Stmt->execute() #2 D:\projects\pocketmine-dev-env-new\virions\libasynql\src\poggit\libasynql\base\SqlSlaveThread.php(88): poggit\libasynql\sqlite3\Sqlite3Thread->executeQuery(Object(SQLite3), 2, 'INSERT\nINTO pla...', Array) #3 phar://D:/projects/pocketmine-dev-env-new/PocketMine-MP.phar/src/thread/CommonThreadPartsTrait.php(93): poggit\libasynql\base\SqlSlaveThread->onRun() #4 [internal function]: pocketmine\thread\Thread->run() #5 {main} thrown in D:\projects\pocketmine-dev-env-new\virions\libasynql\src\poggit\libasynql\sqlite3\Sqlite3Thread.php on line 89
Sample code Query:
INSERT INTO players (xuid, ip) VALUES (:xuid, :ip)
Table:
CREATE TABLE IF NOT EXISTS players ( xuid VARCHAR(255) NOT NULL PRIMARY KEY ON CONFLICT ABORT, ip VARCHAR(255) NOT NULL, permBanned BOOLEAN NOT NULL DEFAULT FALSE, unbanAt INT NOT NULL DEFAULT 0, warns INT NOT NULL DEFAULT 0 )Expected behavior Errors would be returned in the onError function.
Environment OS: Windows PocketMine version: 4.7.0 / 1.19.20
What is the error message above the stack trace?
Fatal error: Uncaught ErrorException: SQLite3Stmt::execute(): Unable to execute statement: UNIQUE constraint failed: players.xuid in D:\projects\pocketmine-dev-env-new\virions\libasynql\src\poggit\libasynql\sqlite3\Sqlite3Thread.php:89
Wrapping the code that runs the query in a try/catch does nothing.
Hello, when do you plan to release an update (containing the bug fix)?
I've done some research and it seems that it's the synchronised used to wait for responses during the waitAll that's blocking everything, when there's a crash, and we close the server with a waitAll to wait for all the query responses, the synchronised loops around without returning anything.
It is simply because the thread does not try to catch errors, thus never sending SqlErrorResult properly
It is simply because the thread does not try to catch errors, thus never sending SqlErrorResult properly
When do you plan to solve this problem?
if anyone sends a pull request to fix it
if anyone sends a pull request to fix it
When will the problem be solved?