Swift 1.2 - Runtime crash in 32-bit iOS simulator with ReactiveCocoa library

Originator:jari.aarniala
Number:rdar://20523979 Date Originated:14-Apr-2015
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6.3 (6D570)
Classification:Bug Reproducible:Always
 
Summary:
Using Xcode version 6.3 (6D570), the code below crashes in the iOS simulator when using the iPhone 5 simulator (or other 32-bit simulator) while it seems to work fine with the iPhone 6 simulator.

ViewController.swift:

    let producer: SignalProducer<Int, NoError> = SignalProducer { observer, _ in
      sendNext(observer, 1)
      sendCompleted(observer)
    }
    
    producer |> collect |> start(
      next: { x in println("Next value \(x)") },
      completed: { _ in println("Completed") }
    )

The sample code uses the ReactiveCocoa library, which is included in the attached sample project along with its dependencies (at version https://github.com/ReactiveCocoa/ReactiveCocoa/releases/tag/v3.0-alpha.4)

Steps to Reproduce:
1) Unzip the attached rac-crash-radar.zip and open the included rac-crash-radar.xcodeproject in Xcode

2) Make sure the scheme "rac-crash-radar" is selected, and select iPhone 5 as the simulator device

3) Run the app (cmd+r)

Expected Results:
App runs successfully, and the following is printed in the console (this is what we get when running with the iPhone 6 simulator):

    Next value [1]
    Completed

Actual Results:
App crashes with EXC_BAD_ACCESS. See attached rac-crash-radar.log for full stack trace.

Version:
Xcode version 6.3 (6D570), OS X 10.10.3 (14D131)

Notes:
Here's the related ReactiveCocoa issue: https://github.com/ReactiveCocoa/ReactiveCocoa/issues/1888

Configuration:
iOS (iPhone 5) simulator running on a MacBook Pro (Retina, Mid 2012) with. Crash seems to happen on every run on my machine.

Attachments:
'rac-crash-radar.log' and 'rac-crash-radar.zip' were successfully uploaded.


rac-crash-radar.log:

(lldb) bt
* thread #1: tid = 0xca3ce, 0x02256996 libswiftCore.dylib`_swift_release_dealloc + 6, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x38)
    frame #0: 0x02256996 libswiftCore.dylib`_swift_release_dealloc + 6
    frame #1: 0x001d1c6b ReactiveCocoa`___lldb_unnamed_function261$$ReactiveCocoa + 171
    frame #2: 0x001b6573 ReactiveCocoa`___lldb_unnamed_function17$$ReactiveCocoa + 35
  * frame #3: 0x001b4c00 ReactiveCocoa`static ReactiveCocoa.|> infix <A, B : ReactiveCocoa.ErrorType, C>(signal=<unavailable>, transform=<unavailable>) -> C) -> C + 128 at Signal.swift:133
    frame #4: 0x001b5e14 ReactiveCocoa`ReactiveCocoa.collect <A, B : ReactiveCocoa.ErrorType>(signal=<unavailable>) -> ReactiveCocoa.Signal<Swift.Array<A>, B> + 532 at Signal.swift:220
    frame #5: 0x002113cd ReactiveCocoa`_TFFFV13ReactiveCocoa14SignalProducer4liftU_S_9ErrorType__FGS0_Q_Q0__U_S1___FFGCS_6SignalQd__Qd_0__GS2_Q_Q0__GS0_Q_Q0__U_FTGVSs6SinkOfGOS_5EventQ_Q0___CS_19CompositeDisposable_T_U_FTGS2_Qd__Qd_0__PS_10Disposable__T_(signal=<unavailable>, innerDisposable=<unavailable>, outerDisposable=<unavailable>, transform=<unavailable>, observer=<unavailable>) + 285 at SignalProducer.swift:250
    frame #6: 0x0020f228 ReactiveCocoa`_TPA__TFFFV13ReactiveCocoa14SignalProducer4liftU_S_9ErrorType__FGS0_Q_Q0__U_S1___FFGCS_6SignalQd__Qd_0__GS2_Q_Q0__GS0_Q_Q0__U_FTGVSs6SinkOfGOS_5EventQ_Q0___CS_19CompositeDisposable_T_U_FTGS2_Qd__Qd_0__PS_10Disposable__T_ + 200 at SignalProducer.swift:0
    frame #7: 0x001f3001 ReactiveCocoa`ReactiveCocoa.SignalProducer.startWithSignal <A, B : ReactiveCocoa.ErrorType>(setUp=<unavailable>, self=<unavailable>)((ReactiveCocoa.Signal<A, B>, ReactiveCocoa.Disposable) -> ()) -> () + 465 at SignalProducer.swift:197
    frame #8: 0x00211274 ReactiveCocoa`_TFFV13ReactiveCocoa14SignalProducer4liftU_S_9ErrorType__FGS0_Q_Q0__U_S1___FFGCS_6SignalQd__Qd_0__GS2_Q_Q0__GS0_Q_Q0__U_FTGVSs6SinkOfGOS_5EventQ_Q0___CS_19CompositeDisposable_T_(observer=<unavailable>, outerDisposable=<unavailable>, self=<unavailable>, transform=<unavailable>) + 356 at SignalProducer.swift:251
    frame #9: 0x001f3f9a ReactiveCocoa`_TPA__TFFV13ReactiveCocoa14SignalProducer4liftU_S_9ErrorType__FGS0_Q_Q0__U_S1___FFGCS_6SignalQd__Qd_0__GS2_Q_Q0__GS0_Q_Q0__U_FTGVSs6SinkOfGOS_5EventQ_Q0___CS_19CompositeDisposable_T_ + 234 at SignalProducer.swift:0
    frame #10: 0x001f31c2 ReactiveCocoa`ReactiveCocoa.SignalProducer.startWithSignal <A, B : ReactiveCocoa.ErrorType>(setUp=<unavailable>, self=<unavailable>)((ReactiveCocoa.Signal<A, B>, ReactiveCocoa.Disposable) -> ()) -> () + 914 at SignalProducer.swift:210
    frame #11: 0x001f369c ReactiveCocoa`ReactiveCocoa.SignalProducer.start <A, B : ReactiveCocoa.ErrorType>(sink=<unavailable>, self=<unavailable>)<C : Swift.SinkType>(C) -> ReactiveCocoa.Disposable + 428 at SignalProducer.swift:225
    frame #12: 0x001f3c8d ReactiveCocoa`ReactiveCocoa.SignalProducer.start <A, B : ReactiveCocoa.ErrorType>(next=Some, error=None, completed=Some, interrupted=None, self=<unavailable>)(next : Swift.Optional<(A) -> ()>, error : Swift.Optional<(B) -> ()>, completed : Swift.Optional<() -> ()>, interrupted : Swift.Optional<() -> ()>) -> ReactiveCocoa.Disposable + 461 at SignalProducer.swift:237
    frame #13: 0x002051bf ReactiveCocoa`ReactiveCocoa.start <A, B : ReactiveCocoa.ErrorType>(producer=<unavailable>, next=Some, error=None, completed=Some, interrupted=None) -> ()>, error : Swift.Optional<(B) -> ()>, completed : Swift.Optional<() -> ()>, interrupted : Swift.Optional<() -> ()>))(producer : ReactiveCocoa.SignalProducer<A, B>) -> ReactiveCocoa.Disposable + 335 at SignalProducer.swift:1065
    frame #14: 0x00089f60 rac-crash-radar`partial apply forwarder for ReactiveCocoa.start <A, B : ReactiveCocoa.ErrorType>((next : Swift.Optional<(A) -> ()>, error : Swift.Optional<(B) -> ()>, completed : Swift.Optional<() -> ()>, interrupted : Swift.Optional<() -> ()>))(producer : ReactiveCocoa.SignalProducer<A, B>) -> ReactiveCocoa.Disposable + 304 at ViewController.swift:0
    frame #15: 0x001f4421 ReactiveCocoa`static ReactiveCocoa.|> infix <A, B : ReactiveCocoa.ErrorType, C>(producer=<unavailable>, transform=<unavailable>) -> C) -> C + 129 at SignalProducer.swift:302
    frame #16: 0x00089059 rac-crash-radar`rac_crash_radar.ViewController.viewDidLoad (self=0x79f8bc50)() -> () + 729 at ViewController.swift:22
    frame #17: 0x000892a2 rac-crash-radar`@objc rac_crash_radar.ViewController.viewDidLoad (rac_crash_radar.ViewController)() -> () + 34 at ViewController.swift:0
    frame #18: 0x00e6fda4 UIKit`-[UIViewController loadViewIfRequired] + 771
    frame #19: 0x00e70095 UIKit`-[UIViewController view] + 35
    frame #20: 0x00d61e85 UIKit`-[UIWindow addRootViewControllerViewIfPossible] + 66
    frame #21: 0x00d6234c UIKit`-[UIWindow _setHidden:forced:] + 287
    frame #22: 0x00d62648 UIKit`-[UIWindow _orderFrontWithoutMakingKey] + 49
    frame #23: 0x00d709b6 UIKit`-[UIWindow makeKeyAndVisible] + 80
    frame #24: 0x00d05ed8 UIKit`-[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3217
    frame #25: 0x00d09422 UIKit`-[UIApplication _runWithMainScene:transitionContext:completion:] + 1639
    frame #26: 0x00d2293e UIKit`__84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59
    frame #27: 0x00d0804a UIKit`-[UIApplication workspaceDidEndTransaction:] + 155
    frame #28: 0x07253c9e FrontBoardServices`__37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
    frame #29: 0x0725372f FrontBoardServices`__40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
    frame #30: 0x07265d7c FrontBoardServices`__31-[FBSSerialQueue performAsync:]_block_invoke_2 + 30
    frame #31: 0x00409050 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 16
    frame #32: 0x003fe963 CoreFoundation`__CFRunLoopDoBlocks + 195
    frame #33: 0x003fe7bb CoreFoundation`__CFRunLoopRun + 2715
    frame #34: 0x003fda5b CoreFoundation`CFRunLoopRunSpecific + 443
    frame #35: 0x003fd88b CoreFoundation`CFRunLoopRunInMode + 123
    frame #36: 0x00d07a02 UIKit`-[UIApplication _run] + 571
    frame #37: 0x00d0b106 UIKit`UIApplicationMain + 1526
    frame #38: 0x0008f144 rac-crash-radar`main + 180 at AppDelegate.swift:12
    frame #39: 0x025f9ac9 libdyld.dylib`start + 1
(lldb)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!