024-11-19 18:30:58.284 UTC [649591] ERROR: deadlock detected
2024-11-19 18:30:58.284 UTC [649591] DETAIL: Process 649591 waits for ShareLock on transaction 49746958; blocked by process 649589.
Process 649589 waits for ShareLock on transaction 49746959; blocked by process 649591.
Process 649591: DELETE FROM "drive_file" WHERE "id" IN ($1)
Process 649589: DELETE FROM "user" WHERE "id" IN ($1)
2024-11-19 18:30:58.284 UTC [649591] HINT: See server log for query details.
2024-11-19 18:30:58.284 UTC [649591] CONTEXT: while updating tuple (15737,1) in relation "user"
SQL statement "UPDATE ONLY "public"."user" SET "bannerId" = NULL WHERE $1::pg_catalog.text OPERATOR(pg_catalog.=) "bannerId"::pg_catalog.text"
2024-11-19 18:30:58.284 UTC [649591] STATEMENT: DELETE FROM "drive_file" WHERE "id" IN ($1)
2024-11-19 18:30:58.333 UTC [649589] LOG: duration: 1050.252 ms execute <unnamed>: DELETE FROM "user" WHERE "id" IN ($1)
2024-11-19 18:30:58.333 UTC [649589] DETAIL: parameters: $1 = '9zlddyw7rq6n0etg'
INFO 2 [remote ap] Deleting the Actor: https://social.vivaldi.net/users/ismaelwahid
INFO 3 [queue delete-account] Deleting account of 9zlddyw7rq6n0etg ...
DONE 3 [queue delete-account] All of notes deleted
DONE 3 [queue delete-account] All of files deleted
INFO 2 [remote ap] Updating the Person: https://social.vivaldi.net/users/ismaelwahid
QueryFailedError: deadlock detected
at PostgresQueryRunner.query (/misskey/node_modules/.pnpm/typeorm@0.3.20_ioredis@5.4.1_pg@8.13.1/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async DeleteQueryBuilder.execute (/misskey/node_modules/.pnpm/typeorm@0.3.20_ioredis@5.4.1_pg@8.13.1/node_modules/typeorm/query-builder/DeleteQueryBuilder.js:52:33) {
query: 'DELETE FROM "drive_file" WHERE "id" IN ($1)',
parameters: [ '9zlddz8grq6n0eth' ],
driverError: error: deadlock detected
at /misskey/node_modules/.pnpm/pg@8.13.1/node_modules/pg/lib/client.js:535:17
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async PostgresQueryRunner.query (/misskey/node_modules/.pnpm/typeorm@0.3.20_ioredis@5.4.1_pg@8.13.1/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:184:25)
at async DeleteQueryBuilder.execute (/misskey/node_modules/.pnpm/typeorm@0.3.20_ioredis@5.4.1_pg@8.13.1/node_modules/typeorm/query-builder/DeleteQueryBuilder.js:52:33) {
length: 483,
severity: 'ERROR',
code: '40P01',
detail: 'Process 649591 waits for ShareLock on transaction 49746958; blocked by process 649589.\n' +
'Process 649589 waits for ShareLock on transaction 49746959; blocked by process 649591.',
hint: 'See server log for query details.',
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: 'while updating tuple (15737,1) in relation "user"\n' +
'SQL statement "UPDATE ONLY "public"."user" SET "bannerId" = NULL WHERE $1::pg_catalog.text OPERATOR(pg_catalog.=) "bannerId"::pg_catalog.text"',
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'deadlock.c',
line: '1147',
routine: 'DeadLockReport'
},
length: 483,
severity: 'ERROR',
code: '40P01',
detail: 'Process 649591 waits for ShareLock on transaction 49746958; blocked by process 649589.\n' +
'Process 649589 waits for ShareLock on transaction 49746959; blocked by process 649591.',
hint: 'See server log for query details.',
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: 'while updating tuple (15737,1) in relation "user"\n' +
'SQL statement "UPDATE ONLY "public"."user" SET "bannerId" = NULL WHERE $1::pg_catalog.text OPERATOR(pg_catalog.=) "bannerId"::pg_catalog.text"',
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
๐ Steps to Reproduce
I can't reproduce it on purpose but I did contact another instance owner and they observed the same issue ...
* Installation Method or Hosting Service: Docker-compose.yml (https://forge.yumechi.jp/yume/yumechi-no-kuni/src/branch/develop/compose_example.yml)
* Misskey: [2024.11.0-yumechinokuni.5](https://forge.yumechi.jp/yume/yumechi-no-kuni/src/tag/2024.11.0-yumechinokuni.5) (tracking misskey-dev#develop)
* OS and Architecture: Arch Linux x86_64
Reported to be also reproducible on:
https://github.com/paricafe/misskey/tree/pari
Do you want to address this bug yourself?
[x] Yes, I will patch the bug myself and send a pull request
๐ก Summary
ใชใขใผใใใ"Delete"ใจ"Update"ใขใฏใใใใฃใใใผใฟ็ซถๅใใใพใใๅๆใซๅใๅใฃใใ็ซถๅใ่ตทใใใขใซใฆใณใใฏๅ้คใงใใพใใใ
Proposed fix (not deployed yet) partially taken from #14752, should also fix #14728 as a side effect : https://forge.yumechi.jp/yume/yumechi-no-kuni/commit/7a581b7e80209c30cef7b47f95efa40e3f0f3797
Partial diff:
๐ฅฐ Expected Behavior
Delete ใขใฏใใฃใใใฃใฎๅฆ็ใขใใใใฏๅใซใใฆไธใซUpdateใใๅชๅ ใใใ
๐คฌ Actual Behavior
Deadlockใไฝๅ็นฐใ่ฟใใฆใใ
๐ Steps to Reproduce
I can't reproduce it on purpose but I did contact another instance owner and they observed the same issue ...
ๅๆๆกไปถใ่ค้ใใใซๆๅณ็ใซๅ็พใใใใจใฏใงใใพใใใใๅฅใฎใคใณในใฟใณในๆๆ่ ใซ้ฃ็ตกใใใจใใใๅใๅ้กใ็บ็ใใฆใใใใใงใใ
๐ป Frontend Environment
๐ฐ Backend Environment (for server admin)
Do you want to address this bug yourself?