ReactiveX/RxSwift

Crash: value tried to resume its continuation more than once

ifabijanovic opened this issue · 2 comments

Short description of the issue:

Seeing a new crash after updating to RxSwift 6.6.0

Expected outcome:

Does not crash

What actually happens:

After updating to RxSwift 6.6.0 started seeing crashes with this message:

`_Concurrency/CheckedContinuation.swift:167: Fatal error: SWIFT TASK CONTINUATION MISUSE: value tried to resume its continuation more than once, returning <some_value>!`

We downgraded to 6.5.0 and the crash went away.

Self contained code example that reproduces the issue:

I do not have a code sample, the crash stack trace just shows RxSwift code, it is unclear where in the App code is it originating from.

RxSwift/RxCocoa/RxBlocking/RxTest version/commit

Crashes in RxSwift 6.6.0, does not in 6.5.0

Platform/Environment

  • iOS
  • macOS
  • tvOS
  • watchOS
  • playgrounds

How easy is to reproduce? (chances of successful reproduce after running the self contained code)

  • easy, 100% repro
  • sometimes, 10%-100%
  • hard, 2% - 10%
  • extremely hard, %0 - 2%

Xcode version:

  15.0.0

⚠️ Fields below are optional for general issues or in case those questions aren't related to your issue, but filling them out will increase the chances of getting your issue resolved. ⚠️

Installation method:

  • CocoaPods
  • Carthage
  • Git submodules
  • SPM

I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)

  • yes (which ones)
  • no

Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)

  • just starting
  • I have a small code base
  • I have a significant code base
Crashed: rxswift.queue.DispatchQoS(qosClass: Dispatch.DispatchQoS.QoSClass.default, relativePriority: 0)
0  libswiftCore.dylib             0x38870 _assertionFailure(_:_:file:line:flags:) + 264
1  libswift_Concurrency.dylib     0x59a0 CheckedContinuation.resume(returning:) + 504
2  App                            0x7a1718 closure #1 in closure #1 in closure #1 in PrimitiveSequenceType<>.value.getter + 38 (PrimitiveSequence+Concurrency.swift:38)
3  App                            0x7bc6bc closure #1 in PrimitiveSequenceType<>.subscribe(onSuccess:onFailure:onDisposed:) + 149 (Single.swift:149)
4  App                            0x7bc830 partial apply for closure #1 in PrimitiveSequenceType<>.subscribe(onSuccess:onFailure:onDisposed:) + 4310337584 (<compiler-generated>:4310337584)
5  App                            0x7bc108 closure #1 in PrimitiveSequenceType<>.subscribe(_:) + 59 (Single.swift:59)
6  App                            0x79cf54 partial apply for closure #1 in ObservableType.subscribe(_:) + 22 (ObservableType+Extensions.swift:22)
7  App                            0x75015c AnonymousObserver.onCore(_:) + 23 (AnonymousObserver.swift:23)
8  App                            0x79facc ObserverBase.on(_:) + 16 (ObserverBase.swift:16)
9  App                            0x79fc10 protocol witness for ObserverType.on(_:) in conformance ObserverBase<A> + 4310219792 (<compiler-generated>:4310219792)
10 App                            0x7be9c8 Sink.forwardOn(_:) + 35 (Sink.swift:35)
11 App                            0x751484 AsSingleSink.on(_:) + 28 (AsSingle.swift:28)
12 App                            0x751650 protocol witness for ObserverType.on(_:) in conformance AsSingleSink<A> + 4309898832 (<compiler-generated>:4309898832)
13 App                            0x7be9c8 Sink.forwardOn(_:) + 35 (Sink.swift:35)
14 App                            0x7c5e94 TakeCountSink.on(_:) + 87 (Take.swift:87)
15 App                            0x7c5f94 protocol witness for ObserverType.on(_:) in conformance TakeCountSink<A> + 4310376340 (<compiler-generated>:4310376340)
16 App                            0x7be9c8 Sink.forwardOn(_:) + 35 (Sink.swift:35)
17 App                            0x7caf90 TimeoutSink.on(_:) + 85 (Timeout.swift:85)
18 App                            0x7cb2e0 protocol witness for ObserverType.on(_:) in conformance TimeoutSink<A> + 4310397664 (<compiler-generated>:4310397664)
19 App                            0x7be9c8 Sink.forwardOn(_:) + 35 (Sink.swift:35)
20 App                            0x791130 MapSink.on(_:) + 43 (Map.swift:43)
21 App                            0x791250 protocol witness for ObserverType.on(_:) in conformance MapSink<A, B> + 4310159952 (<compiler-generated>:4310159952)
22 App                            0x7be9c8 Sink.forwardOn(_:) + 35 (Sink.swift:35)
23 App                            0x77851c DeferredSink.on(_:) + 49 (Deferred.swift:49)
24 App                            0x77863c protocol witness for ObserverType.on(_:) in conformance DeferredSink<A, B> + 4310058556 (<compiler-generated>:4310058556)
25 App                            0x7be9c8 Sink.forwardOn(_:) + 35 (Sink.swift:35)
26 App                            0x791130 MapSink.on(_:) + 43 (Map.swift:43)
27 App                            0x791250 protocol witness for ObserverType.on(_:) in conformance MapSink<A, B> + 4310159952 (<compiler-generated>:4310159952)
28 App                            0x79e524 ObserveOnSink.run(_:_:) + 134 (ObserveOn.swift:134)
29 App                            0x79f71c partial apply for thunk for @escaping @callee_guaranteed (@unowned @callee_guaranteed () -> ()) -> () + 4310218524 (<compiler-generated>:4310218524)
30 App                            0x7ad784 partial apply for thunk for @escaping @callee_guaranteed (@in_guaranteed A, @unowned @callee_guaranteed @substituted <A> (@in_guaranteed A) -> () for <A>) -> () + 4310275972 (<compiler-generated>:4310275972)
31 App                            0x7ad140 closure #1 in RecursiveImmediateScheduler.schedule(_:) + 175 (RecursiveScheduler.swift:175)
32 App                            0x77d380 closure #1 in DispatchQueueConfiguration.schedule<A>(_:action:) + 27 (DispatchQueueConfiguration.swift:27)
33 App                            0x773304 thunk for @escaping @callee_guaranteed () -> () + 4310037252 (<compiler-generated>:4310037252)
34 libdispatch.dylib              0x26a8 _dispatch_call_block_and_release + 32
35 libdispatch.dylib              0x4300 _dispatch_client_callout + 20
36 libdispatch.dylib              0x77b8 _dispatch_continuation_pop + 600
37 libdispatch.dylib              0x6e68 _dispatch_async_redirect_invoke + 732
38 libdispatch.dylib              0x15be4 _dispatch_root_queue_drain + 392
39 libdispatch.dylib              0x163ec _dispatch_worker_thread2 + 156
40 libsystem_pthread.dylib        0x1928 _pthread_wqthread + 228
41 libsystem_pthread.dylib        0x1a04 start_wqthread + 8

It looks like this could be related to #2427, the didResume value is not synchronized