From e02d09748e8aa0c33f4a9b0bbe2f98028d504b0c Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 6 Feb 2026 13:05:23 +0100 Subject: [PATCH] fix(propagator): Ensure rows are always locked in the same order This prevents deadlock when running multiple propagator at the same time. Signed-off-by: Carl Schwan --- lib/private/Files/Cache/Propagator.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php index 4a0c320340123..123da983c8ae2 100644 --- a/lib/private/Files/Cache/Propagator.php +++ b/lib/private/Files/Cache/Propagator.php @@ -59,6 +59,7 @@ public function propagateChange(string $internalPath, int $time, int $sizeDiffer } $parentHashes = array_map('md5', $parents); + sort($parentHashes); // Ensure rows are always locked in the same order $etag = uniqid(); // since we give all folders the same etag we don't ask the storage for the etag $builder = $this->connection->getQueryBuilder(); @@ -160,6 +161,9 @@ public function commitBatch(): void { } $this->inBatch = false; + // Ensure rows are always locked in the same order + uasort($this->batch, static fn (array $a, array $b) => $a['hash'] <=> $b['hash']); + try { $this->connection->beginTransaction();