Skip to content

fix(dav): avoid nesting transactions in sync services - #65937

Open
SebastianKrupinski wants to merge 1 commit into
masterfrom
fix/federation-sync-part-1-transactions
Open

SebastianKrupinski wants to merge 1 commit into
masterfrom
fix/federation-sync-part-1-transactions

Conversation

@SebastianKrupinski

@SebastianKrupinski SebastianKrupinski commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Resolves: # Client Ticket
  • remove the per-card atomic() wrapper in SyncService::syncRemoteAddressBook(). getCard + createCard/updateCard are already atomic individually.
  • remove the atomic() wrapper in SyncService::updateUser().
  • Also call createCardFromUser() only once, before any DB work. It's currently called inside the transaction on both branches, and it's the slow part (avatar and account data).

Checklist

AI (if applicable)

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

@SebastianKrupinski

Copy link
Copy Markdown
Contributor Author

/backport to stable35

@SebastianKrupinski

Copy link
Copy Markdown
Contributor Author

/backport to stable34

@SebastianKrupinski

Copy link
Copy Markdown
Contributor Author

/backport to stable33

@tcitworld

Copy link
Copy Markdown
Member

Why would these be long-running transactions since only one card is updated at a time ?

@SebastianKrupinski SebastianKrupinski changed the title fix(dav): avoid long-running transactions in sync services fix(dav): avoid nesting transactions in sync services Oct 26, 2026
@SebastianKrupinski

Copy link
Copy Markdown
Contributor Author

Why would these be long-running transactions since only one card is updated at a time ?

Sorry, I used the wrong wording! The issue is nesting, I am working to improving how long the sync takes also and mixed the two up

The nested transactions case a dead lock error:

An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT DOCTRINE_2 does not exist

As createCard(), updateCard() and deleteCard() each open their own atomic() there is no point in wrapping them in another transaction

Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
@SebastianKrupinski
SebastianKrupinski force-pushed the fix/federation-sync-part-1-transactions branch from d0ff8dc to ba88d55 Compare October 26, 2026 16:50
@tcitworld

Copy link
Copy Markdown
Member

As createCard(), updateCard() and deleteCard() each open their own atomic() there is no point in wrapping them in another transaction

Well, the need was read-after-write kind of issue, but there's very low risk in these cases, and no way to avoid your issue anyway.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: 🏗️ In progress

Development

Successfully merging this pull request may close these issues.

2 participants