Skip to content

start() holds the sync engines lock while CKSyncEngine decodes its saved state #577

Open

Description

@mario-luis-dev

As mentioned in #568: start() creates both CKSyncEngines inside syncEngines.withValue (SyncEngine.swift#L456-L466), so decoding a large state serialization holds the lock that isRunning (#L449) and the willResignActive handler (#L290) also take. With a 15 MB state I measured 12 to 14 second hangs on the main thread while the decode ran in the background.

I work around it by clearing the state once it passes 5 MB, which can drop unsent changes. Could the engines be created before taking the lock?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions