Rank 1: Thread
After having updated to 1.8.0 yesterday I tested the setup with no issues. Today I got message that our application is unreachable. Investigation showed that the database and the swoole worker pool got deadlocked by queries run during the migration.
Server: 16GB/8CPU
Worker configuration: _APP_WORKER_PER_CORE=10, 8 CPU cores = 80 Swoole workers
This is the information I found:
Deadlocked queries:
-- Query ID: 12, Runtime: 45,413 seconds (12.6 hours)
-- State: Waiting for table metadata lock
-- Origin: console project (host: c9607d771422)
UPDATE `appwrite`.`_console_project` ...
-- Query ID: 65, Runtime: 78,330 seconds (21.7 hours)
-- State: Waiting for table metadata lock
INSERT INTO `appwrite`.`_2_stats` (`_createdAt`, `_permissions`, `_uid`, `_updatedAt`, `metric`, `pe...
-- Query IDs: 110, 112, 150, 151, 154, 156, 158
-- Runtime: 13,012 - 85,013 seconds (3.6 - 23.6 hours)
-- State: Waiting for table metadata lock
-- Origin: localhost (likely migration or backup process)
LOCK TABLES `_1__metadata` READ /*!32311 LOCAL */,
`_1__metadata_perms` READ /*!32311 LOCAL */,
`_1_ab... [truncated]
[see detailed info in the thread below, due to Discord character limit]
Hope this gives some insights. I'm wondering, is there a misconfiguration involved on my side? I'm managing another application too (still on 1.7.4), and am a little worried about updating it at the moment.
Restarting the appwrite container and killing the stuck queries using docker exec appwrite-mariadb mysql -u user -ppassword -e 'KILL 110; KILL 112; KILL 150; KILL 151; KILL 154; KILL 156; KILL 158; KILL 65; KILL 12;' got the backend back running, but I guess this is something to investigate nevertheless?
Please let me know if there is more information I can provide.