Frequent deadlocks in PostgreSQL logs

We are running the orthancteam/orthanc:25.2.0 (includes postgresql-index plugin version 7.2) image on a large Orthanc instance. We noticed that the postgresql server logs contain a lot of lines like this:

2025-06-03 22:18:14.717 UTC [7624] ERROR:  deadlock detected
2025-06-03 22:18:14.717 UTC [7624] DETAIL:  Process 7624 waits for AccessExclusiveLock on tuple (182243,19) of relation 16394 of database 13470; blocked by process 7603.
#011Process 7603 waits for ShareLock on transaction 702901466; blocked by process 7599.
#011Process 7599 waits for ShareLock on transaction 702901489; blocked by process 7626.
#011Process 7626 waits for AccessExclusiveLock on tuple (182243,19) of relation 16394 of database 13470; blocked by process 7624.
#011Process 7624: SELECT * FROM CreateInstance($1, $2, $3, $4)
#011Process 7603: SELECT * FROM CreateInstance($1, $2, $3, $4)
#011Process 7599: SELECT * FROM CreateInstance($1, $2, $3, $4)
#011Process 7626: SELECT * FROM UpdateInvalidChildCounts()

Attaching a ~2500 line part of the logs that shows several similar deadlocks:
postgres-deadlocks.txt (256.9 KB)

All of the deadlocks seem to involve this:

SELECT * FROM UpdateInvalidChildCounts()

The only thing I found yet is that this is getting called every second as part of some “housekeeping” process.

Will try to provide more details later (planning to update to orthancteam/orthanc:25.4.2 soon, see if it’s the same there) but in the meantime, any advice or guidance is greatly appreciated!

Thank you!

Hi,

You should not worry about these deadlocks. The transactions are retried and no data is lost.

Best,

Alain

1 Like