Skip to content

fix(db): convert driver exceptions raised by COMMIT - #64506

Draft
hamza221 wants to merge 1 commit into
masterfrom
fix/db/retry-deadlock-raised-at-commit
Draft

hamza221 wants to merge 1 commit into
masterfrom
fix/db/retry-deadlock-raised-at-commit

Conversation

@hamza221

Copy link
Copy Markdown
Contributor

Doctrine converts driver-level exceptions into typed DBAL exceptions for queries, but Connection::doCommit() leaves them untouched. A deadlock, or a Galera certification failure, raised at commit time therefore surfaced as a raw Doctrine\DBAL\Driver\PDO\PDOException. That class implements the driver exception interface, not Doctrine\DBAL\Exception, so ConnectionAdapter::commit() never wrapped it into a DbalException and the retry loop in Propagator::propagateChange() never saw it. The error reached the user as an HTTP 500, shown as "unknown error" in the web interface, when several uploads updated the same parent folder rows at once. Group folders hit this often because every member shares one storage.

Run the driver exception through the platform exception converter so error 1213 becomes a DeadlockException and callers can detect it as retryable.

Also guard both rollback calls in the propagator. A failed commit has already ended the transaction, so rolling back throws "there is no active transaction" and masks the original error.

Assisted-by: ClaudeCode:claude-opus-5

  • Resolves: #

Summary

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Doctrine converts driver-level exceptions into typed DBAL exceptions for
queries, but Connection::doCommit() leaves them untouched. A deadlock, or a
Galera certification failure, raised at commit time therefore surfaced as a
raw Doctrine\DBAL\Driver\PDO\PDOException. That class implements the driver
exception interface, not Doctrine\DBAL\Exception, so
ConnectionAdapter::commit() never wrapped it into a DbalException and the
retry loop in Propagator::propagateChange() never saw it. The error reached
the user as an HTTP 500, shown as "unknown error" in the web interface, when
several uploads updated the same parent folder rows at once. Group folders
hit this often because every member shares one storage.

Run the driver exception through the platform exception converter so error
1213 becomes a DeadlockException and callers can detect it as retryable.

Also guard both rollback calls in the propagator. A failed commit has
already ended the transaction, so rolling back throws "there is no active
transaction" and masks the original error.

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Hamza <hamzamahjoubi221@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants