Commit 715758b
[fix/stuck-sync-loop] Break endless upload loop for removed placeholder items
The sync pipeline could get stuck in an endless loop: the Status view kept
showing repeating "[CORE, Replay] Found removedItems=(…)" entries for
placeholder items (synthetic "_placeholder_" fileID/eTag) that were flagged
`removed` but still carried active upload sync records, while their filenames
accumulated ever more timestamp suffixes. Resolving the recurring Cancel/Retry
issue dialog did not break the loop.
Root cause: when an item that still had a pending/queued upload was removed,
several gaps combined into a permanent deadlock:
- OCSyncActionUpload rescheduled uploads for removed items, hit the
"already exists" case, raised a keep-both issue and looped.
- OCSyncActionDelete left the item's pending upload records running.
- scrubItemSyncStatus skipped removed items entirely, so a removed item with
active-but-non-existent sync record IDs was never scrubbed and never
vacuumed (activeSyncRecordIDs.count > 0) - a state it could never leave.
- Deleting a placeholder issued a doomed server DELETE with a synthetic fileID.
Fixes:
- OCSyncActionUpload.m: scheduleWithContext: bails out early when the item has
meanwhile been removed (looked up via retrieveCacheItemForLocalID:, which
only returns non-removed items). It deschedules the record with
OCErrorCancelled and returns ProcessNext instead of re-uploading. New helper
_localItemHasBeenRemoved. This is the core loop-breaker.
- OCCore+SyncEngine.m: scrubItemSyncStatus no longer ignores removed items. The
existing dangling-record check still protects items with live records, so
removed items whose sync records no longer exist now get their sync activity
cleared, letting the Vacuum item policy purge them. This drains any
pre-existing stuck state on next launch - no account reset required.
- OCSyncActionDelete.m: preflightWithContext: cancels all pending upload sync
records for the item (and contained items) via the new helper
_cancelPendingUploadsForItem:excludingSyncRecordID:, dropping each cancelled
record's reference before commit. scheduleWithContext: short-circuits
placeholder deletions locally instead of issuing a server DELETE that would
fail.
Verified on a physical device carrying the actual stuck state: resolving the
issue dialog once now cascades through the backlog, the lanes drain and the
leftover items are scrubbed and vacuumed. The loop no longer recurs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 7648ca8 commit 715758b
3 files changed
Lines changed: 123 additions & 14 deletions
File tree
- ownCloudSDK/Core/Sync
- Actions
- Delete
- Upload
Lines changed: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
| |||
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
90 | 98 | | |
91 | 99 | | |
92 | 100 | | |
| |||
108 | 116 | | |
109 | 117 | | |
110 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
111 | 164 | | |
112 | 165 | | |
113 | 166 | | |
| |||
161 | 214 | | |
162 | 215 | | |
163 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
164 | 240 | | |
165 | 241 | | |
166 | 242 | | |
| |||
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
160 | 173 | | |
161 | 174 | | |
162 | 175 | | |
| |||
406 | 419 | | |
407 | 420 | | |
408 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
409 | 441 | | |
410 | 442 | | |
411 | 443 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2077 | 2077 | | |
2078 | 2078 | | |
2079 | 2079 | | |
2080 | | - | |
2081 | | - | |
| 2080 | + | |
| 2081 | + | |
2082 | 2082 | | |
2083 | | - | |
2084 | | - | |
2085 | | - | |
2086 | | - | |
2087 | | - | |
2088 | | - | |
2089 | | - | |
2090 | | - | |
2091 | | - | |
2092 | | - | |
2093 | | - | |
2094 | | - | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
2095 | 2096 | | |
2096 | 2097 | | |
2097 | 2098 | | |
| |||
0 commit comments