Skip to content

Deadlock in fetchAll #1184

@olleraab

Description

@olleraab

There is a deadlock when using fetchAll and two objects has pointers refering to each other, indirectly or directly.

When processing the result from fetchAll, all objects are handled individually in separate BFTasks. This happens in PFObjectController - processFetchResultAsync:forObject: in the method _collectFetchedObjects.

_collectFetchedObjects does a @synchronized (lock) on its object, traverses its connected objects, and when calling allKeys on another object, allKeys locks that object @synchronized (lock). Thus if A locks itself and then locks B, and then B locks itself and then locks A, we get a deadlock. This is confirmed when I look at the stack traces, in a lot of threads, they are waiting on a mutex from allKeys.

skarmavbild 2017-09-06 kl 14 04 30

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions