Skip to content

[sync] Fix endless upload loop when a locally modified resource was deleted on the server - #2741

Open
sunkup wants to merge 2 commits into
mainfrom
2739-task-with-local-change-deleted-on-server-sync-conflict-does-not-get-resolved
Open

[sync] Fix endless upload loop when a locally modified resource was deleted on the server#2741
sunkup wants to merge 2 commits into
mainfrom
2739-task-with-local-change-deleted-on-server-sync-conflict-does-not-get-resolved

Conversation

@sunkup

@sunkup sunkup commented Aug 3, 2026

Copy link
Copy Markdown
Member

Purpose

Fixes #2739: a resource that is modified locally and deleted on the server by another client is uploaded again in every sync, forever. Some servers (like DAViCal) answer 412 instead of 404 to our conditional PUT, because per RFC 9110 13.1.1 an If-Match against a non-existing resource must fail with 412. We treat every 412 as "modified on the server in the meanwhile" and ignore it, so the resource stays dirty — but it can never be downloaded, and deleteNotPresentRemotely() skips dirty rows, so nothing resolves it. Affects contacts and events, too.

Short description

  • Added SyncManager.uploadTargetIsGone(), which sends a PROPFIND to find out whether the upload target is still on the server.
  • The 412 and 409 branches of uploadDirty() now use it: if the resource is gone, the upload is retried as a fresh upload (forceAsNew) — the same resolution we already apply when a server answers 404.
  • If the resource is still there, or if the server doesn't give a clear answer, the previous behavior is kept, so a genuine edit conflict is still resolved in favor of the server version.

Related: RFC 9110, section 13.1.1.

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

@sunkup sunkup changed the title Propfind upload target on 409 and 412 responses [sync] Propfind upload target on 409 and 412 responses Aug 3, 2026
@sunkup sunkup changed the title [sync] Propfind upload target on 409 and 412 responses [sync] Fix endless upload loop when a locally modified resource was deleted on the server Aug 3, 2026
@sunkup sunkup added sync Regarding core sync algorithm (Syncer/SyncManager, sync workers) pr-bugfix Fixes something that isn't working (only used for PRs) labels Aug 3, 2026
@sunkup sunkup self-assigned this Aug 3, 2026
@sunkup
sunkup requested review from ArnyminerZ and rfc2822 August 3, 2026 13:43

@rfc2822 rfc2822 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to fully understand and evaluate our 4xx (especially 404/412) handling before we can modify it.

See #2739 (comment) – but needs proper verification and then we can choose an approach. We should probably have a common understanding first.

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

Labels

pr-bugfix Fixes something that isn't working (only used for PRs) sync Regarding core sync algorithm (Syncer/SyncManager, sync workers)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Task with local change, deleted on server: sync conflict does not get resolved

2 participants