Skip to content

Commit

Permalink
Merge pull request #37709 from nextcloud/bugfix/deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored May 13, 2023
2 parents 8cab1d7 + 3bdd770 commit e18f97f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/private/DB/Exceptions/DbalException.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use Doctrine\DBAL\Exception\InvalidFieldNameException;
use Doctrine\DBAL\Exception\NonUniqueFieldNameException;
use Doctrine\DBAL\Exception\NotNullConstraintViolationException;
use Doctrine\DBAL\Exception\RetryableException;
use Doctrine\DBAL\Exception\ServerException;
use Doctrine\DBAL\Exception\SyntaxErrorException;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
Expand Down Expand Up @@ -74,6 +75,10 @@ public static function wrap(\Doctrine\DBAL\Exception $original, string $message
);
}

public function isRetryable(): bool {
return $this->original instanceof RetryableException;
}

public function getReason(): ?int {
/**
* Constraint errors
Expand Down
8 changes: 6 additions & 2 deletions lib/private/Files/Cache/Propagator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

namespace OC\Files\Cache;

use Doctrine\DBAL\Exception\RetryableException;
use OC\DB\Exceptions\DbalException;
use OC\Files\Storage\Wrapper\Encryption;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\Cache\IPropagator;
Expand Down Expand Up @@ -136,7 +136,11 @@ public function propagateChange($internalPath, $time, $sizeDifference = 0) {
try {
$builder->executeStatement();
break;
} catch (RetryableException $e) {
} catch (DbalException $e) {
if (!$e->isRetryable()) {
throw $e;
}

/** @var LoggerInterface $loggerInterface */
$loggerInterface = \OCP\Server::get(LoggerInterface::class);
$loggerInterface->warning('Retrying propagation query after retryable exception.', [ 'exception' => $e ]);
Expand Down

0 comments on commit e18f97f

Please sign in to comment.