Skip to content

EXC_BREAKPOINT DemandBuffer.swift:111 BUG IN CLIENT OF LIBPLATFORM: Trying to recursively lock an os_unfair_lock #114

Open
@dsk1306

Description

@dsk1306

I've just received a huge amount of crash reports caused by an exception during theDemandBuffer deallocation on iOS 13.

CrashReporter Key:  fdb68c604e035dc1461eb2f1d3466cd19894c442
Hardware Model:     iPhone8,4
Role:               Foreground
OS Version:         iOS 13.5.1
Exception Type:     EXC_BREAKPOINT 
Exception Subtype:  KERN_INVALID_ADDRESS


EXC_BREAKPOINT: BUG IN CLIENT OF LIBPLATFORM: Trying to recursively lock an os_unfair_lock

0   libsystem_platform.dylib __os_unfair_lock_recursive_abort
1   libsystem_platform.dylib __os_unfair_lock_lock_slow
2   Combine                  Publishers.ReceiveOn.Inner.receive(completion:)
3   Combine                  protocol witness for Subscriber.receive(completion:) in conformance Publishers.ReceiveOn<A, B>.Inner<A1>
4   Combine                  AnySubscriberBox.receive(completion:)
5   Combine                  protocol witness for Subscriber.receive(completion:) in conformance AnySubscriber<A, B>
6   HomeCodes                flush (DemandBuffer.swift:111:24)
7   HomeCodes                complete (DemandBuffer.swift:70:13)
8   HomeCodes                receive (Sink.swift:75:20)
9   HomeCodes                receive (CurrentValueRelay.swift:96:19)
10  HomeCodes                partial apply for closure #1 in CurrentValueRelay.deinit (CurrentValueRelay.swift:55:36)
11  HomeCodes                partial apply for thunk for @callee_guaranteed (@guaranteed CurrentValueRelay<A>.Subscription<CurrentValueSubject<A, Never>, AnySubscriber<A, Never>>) -> (@error @owned Error) (<compiler-generated>)
12  libswiftCore.dylib       Sequence.forEach(_:)
13  HomeCodes                deinit (CurrentValueRelay.swift:55:23)
14  HomeCodes                deinit (CurrentValueRelay.swift)
15  libswiftCore.dylib       __swift_release_dealloc
16  Combine                  PublisherBox.__deallocating_deinit
17  libswiftCore.dylib       __swift_release_dealloc
18  Combine                  outlined destroy of Publishers.ReceiveOn<A, B>.Inner<A1>.State
19  Combine                  protocol witness for Cancellable.cancel() in conformance Publishers.ReceiveOn<A, B>.Inner<A1>
20  Combine                  Subscribers.Sink.cancel()
21  Combine                  protocol witness for Cancellable.cancel() in conformance Subscribers.Sink<A, B>
22  Combine                  partial apply
23  Combine                  AnyCancellable.__deallocating_deinit
24  libswiftCore.dylib       __swift_release_dealloc
25  libswiftCore.dylib       _swift_arrayDestroy
26  libswiftCore.dylib       _SetStorage.deinit
27  libswiftCore.dylib       _SetStorage.__deallocating_deinit
28  libswiftCore.dylib       __swift_release_dealloc
29  libobjc.A.dylib          object_cxxDestructFromClass(objc_object*, objc_class*)
30  libobjc.A.dylib          _objc_destructInstance
31  libobjc.A.dylib          __objc_rootDealloc
32  UIKitCore                -[UIResponder dealloc]
33  UIKitCore                -[UIViewController dealloc]
34  HomeCodes                deinit (<compiler-generated>)
35  CoreFoundation           ___RELEASE_OBJECTS_IN_THE_ARRAY__
36  CoreFoundation           -[__NSArrayM dealloc]
37  UIKitCore                -[UIViewController dealloc]
38  UIKitCore                -[UINavigationController dealloc]
39  HomeCodes                deinit (BaseCoordinator.swift)
40  HomeCodes                deinit (NavigationCoordinator.swift)
41  HomeCodes                deinit (BaseNavigationCoordinator.swift:32:5)
42  HomeCodes                deinit (BaseNavigationCoordinator.swift)
43  libswiftCore.dylib       __swift_release_dealloc
44  libswiftCore.dylib       bool swift::RefCounts<swift::SideTableRefCountBits>::doDecrement<(swift::PerformDeinit)1>(unsigned int)
45  libswiftCore.dylib       _swift_arrayDestroy
46  HomeCodes                specialized Array.replaceSubrange<A>(_:with:) (HomeCodes)
47  HomeCodes                BaseCoordinator.removeChildrenIfNeeded() (<compiler-generated>)
48  HomeCodes                removeChildrenIfNeeded (<compiler-generated>)
49  HomeCodes                childTransitionCompleted (Coordinator.swift:110:9)
50  HomeCodes                childTransitionCompleted (<compiler-generated>)
51  HomeCodes                partial apply for closure #1 in BaseCoordinator.registerParent(_:) (BaseCoordinator.swift:106:26)
52  HomeCodes                removeChildrenIfNeeded (BaseCoordinator.swift:75:9)
53  HomeCodes                removeChildrenIfNeeded (<compiler-generated>)
54  HomeCodes                childTransitionCompleted (Coordinator.swift:110:9)
55  HomeCodes                childTransitionCompleted (<compiler-generated>)
56  HomeCodes                navigationController (NavigationAnimationDelegate.swift:136:22)
57  HomeCodes                navigationController (<compiler-generated>)
58  UIKitCore                -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:]
59  UIKitCore                -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:]
60  UIKitCore                -[UINavigationTransitionView _cleanupTransition]
61  UIKitCore                +[UIView(UIViewAnimationWithBlocks) conditionallyAnimate:withAnimation:layout:completion:]
62  UIKitCore                -[UINavigationTransitionView transition:fromView:toView:]
63  UIKitCore                -[UINavigationController _startTransition:fromViewController:toViewController:]
64  UIKitCore                -[UINavigationController _startDeferredTransitionIfNeeded:]
65  UIKitCore                -[UINavigationController __viewWillLayoutSubviews]
66  UIKitCore                -[UILayoutContainerView layoutSubviews]
67  UIKitCore                -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
68  QuartzCore               -[CALayer layoutSublayers]
69  QuartzCore               CA::Layer::layout_if_needed(CA::Transaction*)
70  UIKitCore                -[UIView(Hierarchy) layoutBelowIfNeeded]
71  UIKitCore                -[_UISheetPresentationController _sheetLayoutInfoLayout:]
72  UIKitCore                -[_UISheetLayoutInfo _layout]
73  UIKitCore                ___54-[_UISheetPresentationController transitionWillBegin:]_block_invoke_2
74  UIKitCore                +[UIView(Animation) performWithoutAnimation:]
75  UIKitCore                ___54-[_UISheetPresentationController transitionWillBegin:]_block_invoke.341
76  UIKitCore                -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:]
77  UIKitCore                -[_UIViewControllerTransitionContext __runAlongsideAnimations]
78  UIKitCore                ___63+[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:]_block_invoke
79  UIKitCore                -[UIViewAnimationState _runAlongsideAnimations]
80  UIKitCore                -[UIViewAnimationState pop]
81  UIKitCore                +[UIViewAnimationState popAnimationState]
82  UIKitCore                +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:]
83  UIKitCore                +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:]
84  UIKitCore                ___50-[UITransitionView _startTransition:withDuration:]_block_invoke.169
85  UIKitCore                +[UIView(UIViewAnimationWithBlocks) conditionallyAnimate:withAnimation:layout:completion:]
86  UIKitCore                -[UITransitionView _startTransition:withDuration:]
87  UIKitCore                -[UITransitionView transition:fromView:toView:removeFromView:]
88  UIKitCore                -[UIViewControllerBuiltinTransitionViewAnimator animateTransition:]
89  UIKitCore                ____UIViewControllerTransitioningRunCustomTransition_block_invoke_2
90  UIKitCore                +[UIInputResponderController _pinInputViewsForInputResponderController:onBehalfOfResponder:duringBlock:]
91  UIKitCore                ____UIViewControllerTransitioningRunCustomTransition_block_invoke.645
92  UIKitCore                +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:]
93  UIKitCore                __UIViewControllerTransitioningRunCustomTransition
94  UIKitCore                ___56-[UIPresentationController runTransitionForCurrentState]_block_invoke.465
95  UIKitCore                __runAfterCACommitDeferredBlocks
96  UIKitCore                __cleanUpAfterCAFlushAndRunDeferredBlocks
97  UIKitCore                __afterCACommitHandler
98  CoreFoundation           ___CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
99  CoreFoundation           ___CFRunLoopDoObservers
100 CoreFoundation           ___CFRunLoopRun
101 CoreFoundation           _CFRunLoopRunSpecific
102 GraphicsServices         _GSEventRunModal
103 UIKitCore                _UIApplicationMain
104 HomeCodes                main (main.swift:8:1)
105 libdyld.dylib            _start

I've tried to repro it and it looks like it just enough to create a publisher that uses DemandBuffer (e.g. CurrentValueRelay), initialise it and the just deinit it. And it looks like it only reproducible on iOS 13.5 and older.
Did anyone else had the same issue?

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