Page MenuHomePhorge

D5418.1775215346.diff
No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None

D5418.1775215346.diff

diff --git a/lib/ext/Syncroton/Command/FolderSync.php b/lib/ext/Syncroton/Command/FolderSync.php
--- a/lib/ext/Syncroton/Command/FolderSync.php
+++ b/lib/ext/Syncroton/Command/FolderSync.php
@@ -99,12 +99,10 @@
return;
} else {
// The synckey that is sent to us should already be existing, because we create it at the end,
- // however, the next one shouldn't
+ // however, the next one shouldn't. When it does exist it means that the same request has been resent,
+ // which can happen if the client failed to receive the response.
if ($this->_syncStateBackend->haveNext($this->_device, 'FolderSync', $syncKey)) {
$this->_syncKeyReused = true;
- if ($this->_logger instanceof Zend_Log) {
- $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " already known synckey $syncKey provided");
- }
}
}
if (!($this->_syncState = $this->_syncStateBackend->validate($this->_device, 'FolderSync', $syncKey)) instanceof Syncroton_Model_SyncState) {
@@ -112,6 +110,25 @@
$this->_logger->warn(__METHOD__ . '::' . __LINE__ . " invalid synckey $syncKey provided, invalidating sync state");
}
$this->_syncStateBackend->resetState($this->_device, 'FolderSync');
+ } else {
+ // Keep track of how many times we retried this particular sync-key
+ if ($this->_syncKeyReused) {
+ $extraData = json_decode($this->_syncState->extraData, true);
+ $retryCounter = $extraData['retryCounter'] ?? 0;
+ $retryCounter++;
+ if ($this->_logger instanceof Zend_Log) {
+ $this->_logger->info(__METHOD__ . '::' . __LINE__ . " already known synckey $syncKey provided ($retryCounter times)");
+ }
+ if ($retryCounter >= 10) {
+ if ($this->_logger instanceof Zend_Log) {
+ $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " This client is stuck on resending the same FolderSync synckey.");
+ }
+ } else {
+ $extraData['retryCounter'] = $retryCounter;
+ $this->_syncState->extraData = json_encode($extraData);
+ $this->_syncStateBackend->update($this->_syncState);
+ }
+ }
}
}
diff --git a/lib/kolab_sync_backend_state.php b/lib/kolab_sync_backend_state.php
--- a/lib/kolab_sync_backend_state.php
+++ b/lib/kolab_sync_backend_state.php
@@ -52,6 +52,23 @@
return $object;
}
+ /**
+ * Updates a sync state of a folder
+ *
+ * @param Syncroton_Model_ISyncState $object State object
+ *
+ * @return object Object
+ * @throws InvalidArgumentException|Syncroton_Exception_DeadlockDetected|Exception
+ */
+ public function update($object)
+ {
+ $counterNext = $object->counterNext;
+ unset($object->counterNext);
+ $object = parent::update($object);
+ $object->counterNext = $counterNext;
+ return $object;
+ }
+
/**
* Deletes states other than specified one
*/

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 11:22 AM (3 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823812
Default Alt Text
D5418.1775215346.diff (3 KB)

Event Timeline