Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-8104] Crashes related to enums in Xcode 9.3.1 #50636

Closed
swift-ci opened this issue Jun 25, 2018 · 17 comments
Closed

[SR-8104] Crashes related to enums in Xcode 9.3.1 #50636

swift-ci opened this issue Jun 25, 2018 · 17 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software regression run-time crash Bug → crash: Swift code crashed during execution swift 4.1

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-8104
Radar rdar://problem/41474372
Original Reporter MonocularVision (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Xcode 9.3
Build version 9E145

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.1Regression, RunTimeCrash
Assignee None
Priority Medium

md5: 2aed21fd5b191aacaa7ea9f76e02068f

Issue Description:

After building our app using Xcode 9.3.1, we've started receiving a small, but noticeable amount of crashes around code that seemed to work previously. The crashes are occurring inside of swift_storeEnumTagSinglePayload and swift_getEnumCaseSinglePayload. Searching around I found SR-7743 (which appears to be crashing in a similar place, so we tried disabling optimizations for our latest deployment. That did not seem to fix the issue.

I don't know if these crashes are the same bug but since they started at the same time after upgrading, I'm including them. Note that the names of some of the modules, types and functions needed to be changed before posting here:

# OS Version: 11.4.0 (15F79)
# Device: iPhone 7

#​0. Crashed: com.apple.main-thread
0  libswiftCore.dylib             0x10767a420 swift_getEnumCaseSinglePayload + 36
1  <AppLibrary>                   0x106fd4698 initializeWithCopy for TableSection
2  <AppLibrary>                   0x106fd04e4 TableData.subscript.getter
3  <AppLibrary>                   0x106fd0bf0 TableData<>.cell(for:at:)
4  <App>                          0x104605d10 FooViewController.tableView(_:cellForRowAt:)
5  <App>                          0x104606428 @objc FooViewController.tableView(_:cellForRowAt:)
6  UIKit                          0x18adcc0cc -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 668
7  UIKit                          0x18adcbd84 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
8  UIKit                          0x18adcaaa0 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2280
9  UIKit                          0x18adc65ec -[UITableView layoutSubviews] + 140
10 UIKit                          0x18ad036f4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1420
11 QuartzCore                     0x185279fec -[CALayer layoutSublayers] + 184
12 QuartzCore                     0x18527e17c CA::Layer::layout_if_needed(CA::Transaction*) + 324
13 QuartzCore                     0x1851ea830 CA::Context::commit_transaction(CA::Transaction*) + 320
14 QuartzCore                     0x185212364 CA::Transaction::commit() + 580
15 QuartzCore                     0x1852131e4 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
16 CoreFoundation                 0x18109a910 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
17 CoreFoundation                 0x181098238 __CFRunLoopDoObservers + 412
18 CoreFoundation                 0x181098884 __CFRunLoopRun + 1436
19 CoreFoundation                 0x180fb8da8 CFRunLoopRunSpecific + 552
20 GraphicsServices               0x182f9d020 GSEventRunModal + 100
21 UIKit                          0x18afd5758 UIApplicationMain + 236
22 <App>                          0x10436e674 main (main.m:12)
23 libdyld.dylib                  0x180a49fc0 start + 4
# OS Version: 11.4.0 (15F79)
# Device: iPhone 7 Plus

#&#8203;0. Crashed: com.apple.main-thread
0  libswiftCore.dylib             0x10618a600 swift_storeEnumTagSinglePayload + 36
1  <AppLibrary>                   0x105afb990 TableSection.init(header:rows:footer:)
2  <App>                          0x102eae208 FooViewModel.prepareBarPanels(bar:barItems:pending:)
3  <App>                          0x102ea9a98 FooViewModel.bar.didset
4  <App>                          0x102eaec44 FooViewModel.bar.setter
5  <App>                          0x1030f3058 closure #&#8203;1 in FooViewController.viewDidLoad()
6  <App>                          0x1030f30e0 thunk for @escaping @callee_guaranteed (@owned NetworkResponse<Bar>) -> ()
7  ReactiveSwift                  0x105b71614 closure #&#8203;1 in Signal.Observer.init(value:failed:completed:interrupted:) (Observer.swift:60)
8  ReactiveSwift                  0x105b71b50 partial apply for closure #&#8203;1 in Signal.Observer.init(value:failed:completed:interrupted:) (Observer.swift)
9  ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
10 ReactiveSwift                  0x105b50ee0 closure #&#8203;1 in closure #&#8203;1 in TransformerCore.start(_:) (SignalProducer.swift:354)
11 ReactiveSwift                  0x105b868d8 closure #&#8203;1 in closure #&#8203;1 in static Signal.Event.filterMap<A>(_:) (Event.swift:248)
12 ReactiveSwift                  0x105b8d598 partial apply for closure #&#8203;1 in closure #&#8203;1 in static Signal.Event.filterMap<A>(_:) + 40
13 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
14 ReactiveSwift                  0x105b2de4c Signal.Core.send(_:) (Signal.swift:115)
15 ReactiveSwift                  0x105b7184c closure #&#8203;1 in Signal.Observer.init(mappingInterruptedToCompleted:) (Observer.swift:96)
16 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
17 ReactiveSwift                  0x105b2de4c Signal.Core.send(_:) (Signal.swift:115)
18 ReactiveSwift                  0x105b71aa4 specialized Signal.Observer.send(value:) (Observer.swift:104)
19 ReactiveSwift                  0x105b7ec9c $defer #&#8203;1 <A><A1>() in closure #&#8203;1 in MutableProperty.modify<A>(_:) (Property.swift:712)
20 ReactiveSwift                  0x105b7ec04 closure #&#8203;1 in MutableProperty.modify<A>(_:) (Property.swift:673)
21 ReactiveSwift                  0x105b7fc24 partial apply for closure #&#8203;1 in MutableProperty.modify<A>(_:) (Property.swift)
22 ReactiveSwift                  0x105b7db18 PropertyBox.begin<A>(_:) (Property.swift:757)
23 ReactiveSwift                  0x105b79cfc MutableProperty.modify<A>(_:) (Property.swift:672)
24 ReactiveSwift                  0x105b7feac specialized MutableProperty.value.setter (Property.swift:614)
25 ReactiveSwift                  0x105b7e268 MutableProperty.value.setter (Property.swift)
26 <AppLibrary>                   0x105aeac54 Cached.handle(_:)
27 <AppLibrary>                   0x105aebbe8 partial apply
28 ReactiveSwift                  0x105b5a79c specialized closure #&#8203;1 in SignalProducer.startWithResult(_:) (SignalProducer.swift:570)
29 ReactiveSwift                  0x105b5a60c partial apply for closure #&#8203;1 in SignalProducer.startWithResult(_:) (SignalProducer.swift)
30 ReactiveSwift                  0x105b71614 closure #&#8203;1 in Signal.Observer.init(value:failed:completed:interrupted:) (Observer.swift:60)
31 ReactiveSwift                  0x105b71b50 partial apply for closure #&#8203;1 in Signal.Observer.init(value:failed:completed:interrupted:) (Observer.swift)
32 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
33 ReactiveSwift                  0x105b2de4c Signal.Core.send(_:) (Signal.swift:115)
34 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
35 ReactiveSwift                  0x105b2de4c Signal.Core.send(_:) (Signal.swift:115)
36 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
37 ReactiveSwift                  0x105b31d04 closure #&#8203;1 in closure #&#8203;1 in Signal.on(event:failed:completed:interrupted:terminated:disposed:value:) (Signal.swift:901)
38 ReactiveSwift                  0x105b49c08 partial apply for closure #&#8203;1 in closure #&#8203;1 in Signal.on(event:failed:completed:interrupted:terminated:disposed:value:) (Signal.swift)
39 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
40 ReactiveSwift                  0x105b2de4c Signal.Core.send(_:) (Signal.swift:115)
41 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
42 ReactiveSwift                  0x105b50ee0 closure #&#8203;1 in closure #&#8203;1 in TransformerCore.start(_:) (SignalProducer.swift:354)
43 ReactiveSwift                  0x105b86e84 closure #&#8203;1 in closure #&#8203;1 in static Signal.Event.mapError<A>(_:) (Event.swift:288)
44 ReactiveSwift                  0x105b8fcf4 partial apply for closure #&#8203;1 in closure #&#8203;1 in static Signal.Event.mapError<A>(_:) (Event.swift)
45 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
46 ReactiveSwift                  0x105b2de4c Signal.Core.send(_:) (Signal.swift:115)
47 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
48 ReactiveSwift                  0x105b31d04 closure #&#8203;1 in closure #&#8203;1 in Signal.on(event:failed:completed:interrupted:terminated:disposed:value:) (Signal.swift:901)
49 ReactiveSwift                  0x105b49c08 partial apply for closure #&#8203;1 in closure #&#8203;1 in Signal.on(event:failed:completed:interrupted:terminated:disposed:value:) (Signal.swift)
50 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
51 ReactiveSwift                  0x105b2de4c Signal.Core.send(_:) (Signal.swift:115)
52 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
53 ReactiveSwift                  0x105b31d04 closure #&#8203;1 in closure #&#8203;1 in Signal.on(event:failed:completed:interrupted:terminated:disposed:value:) (Signal.swift:901)
54 ReactiveSwift                  0x105b49c08 partial apply for closure #&#8203;1 in closure #&#8203;1 in Signal.on(event:failed:completed:interrupted:terminated:disposed:value:) (Signal.swift)
55 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
56 ReactiveSwift                  0x105b2de4c Signal.Core.send(_:) (Signal.swift:115)
57 ReactiveSwift                  0x105b70e7c Signal.Observer.send(_:) (Observer.swift:96)
58 ReactiveSwift                  0x105b50ee0 closure #&#8203;1 in closure #&#8203;1 in TransformerCore.start(_:) (SignalProducer.swift:354)
59 ReactiveSwift                  0x105b871d4 closure #&#8203;1 in closure #&#8203;1 in static Signal.Event.attemptMap<A>(_:) (Event.swift:329)
60 ReactiveSwift                  0x105b8d598 partial apply for closure #&#8203;1 in closure #&#8203;1 in static Signal.Event.filterMap<A>(_:) + 40
61 ReactiveSwift                  0x105b86d20 closure #&#8203;1 in closure #&#8203;1 in static Signal.Event.map<A>(_:) (Event.swift:268)
62 ReactiveSwift                  0x105b8d598 partial apply for closure #&#8203;1 in closure #&#8203;1 in static Signal.Event.filterMap<A>(_:) + 40
63 ReactiveSwift                  0x105b86e84 closure #&#8203;1 in closure #&#8203;1 in static Signal.Event.mapError<A>(_:) (Event.swift:288)
64 ReactiveSwift                  0x105b8fcf4 partial apply for closure #&#8203;1 in closure #&#8203;1 in static Signal.Event.mapError<A>(_:) (Event.swift)
65 ReactiveSwift                  0x105b2cf1c specialized Signal.Core.send(_:) (Signal.swift)
66 ReactiveSwift                  0x105b47384 partial apply for specialized  (Signal.swift)
67 ReactiveSwift                  0x105b8472c specialized closure #&#8203;1 in closure #&#8203;1 in Reactive<A>.data(with:) (FoundationExtensions.swift)
68 ReactiveSwift                  0x105b8464c partial apply for closure #&#8203;1 in closure #&#8203;1 in Reactive<A>.data(with:) (FoundationExtensions.swift)
69 ReactiveSwift                  0x105b83cd0 thunk for @escaping @callee_guaranteed (@owned Data?, @owned URLResponse?, @owned Error?) -> () (FoundationExtensions.swift)
70 CFNetwork                      0x185541e4c __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 32
71 CFNetwork                      0x18555ab6c __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 152
72 Foundation                     0x1859dae88 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
73 Foundation                     0x18591c8d0 -[NSBlockOperation main] + 72
74 Foundation                     0x18591bcac -[__NSOperationInternal _start:] + 848
75 libdispatch.dylib              0x1848a4a60 _dispatch_client_callout + 16
76 libdispatch.dylib              0x1848ac170 _dispatch_block_invoke_direct$VARIANT$mp + 224
77 libdispatch.dylib              0x1848a4a60 _dispatch_client_callout + 16
78 libdispatch.dylib              0x1848ac170 _dispatch_block_invoke_direct$VARIANT$mp + 224
79 libdispatch.dylib              0x1848ac05c dispatch_block_perform$VARIANT$mp + 104
80 Foundation                     0x1859dc750 __NSOQSchedule_f + 376
81 libdispatch.dylib              0x1848a4a60 _dispatch_client_callout + 16
82 libdispatch.dylib              0x1848b165c _dispatch_main_queue_callback_4CF$VARIANT$mp + 1012
83 CoreFoundation                 0x184f5b070 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
84 CoreFoundation                 0x184f58bc8 __CFRunLoopRun + 2272
85 CoreFoundation                 0x184e78da8 CFRunLoopRunSpecific + 552
86 GraphicsServices               0x186e5d020 GSEventRunModal + 100
87 UIKit                          0x18ee95758 UIApplicationMain + 236
88 <App>                          0x102e5e674 main (main.m:12)
89 libdyld.dylib                  0x184909fc0 start + 4
# OS Version: 10.3.3 (14G60)
# Device: iPad 4

#&#8203;0. Crashed: com.apple.main-thread
0  libswiftCore.dylib             0x3733bd6 swift_storeEnumTagSinglePayload + 35
1  libswiftCore.dylib             0x346add8 Optional.map<A>(_:) + 124608
2  <App>                          0x8c2f3c static FooViewModel.makeHero(tab:)
3  <App>                          0x8bf0d4 static FooViewModel.makeHeaderView(tab:myData:messages:)
4  <App>                          0x8be4a4 FooViewModel.init(tab:labels:myData:messages:)
5  <App>                          0xd264c0 FooController.rootViewController(_:)
6  <App>                          0xd356ac protocol witness for RootFeatureController.rootViewController(_:) in conformance FooController
7  <AppLibrary>                   0x227bc28 FeatureRunner<>.rootViewController()
8  <App>                          0x64e30c viewController #&#8203;1 <A>(for:tab:) in BarViewController.init(viewModel:state:logout:refresh:switcher:)
9  <App>                          0x6487fc BarViewController.init(viewModel:state:logout:refresh:switcher:)
10 <App>                          0x6469e8 BarViewController.__allocating_init(viewModel:state:logout:refresh:switcher:)
11 <App>                          0x60fbc0 MyRootViewController.updateBarViewController(initialState:)
12 <App>                          0x60c308 MyRootViewController.displayAppropriateViewController()
13 <App>                          0x60b16c MyRootViewController.viewDidAppear(_:)
14 <App>                          0x60b1c4 @objc MyRootViewController.viewDidAppear(_:)
15 UIKit                          0x2225b187 -[UIViewController _setViewAppearState:isAnimating:] + 610
16 UIKit                          0x2225b74b -[UIViewController _endAppearanceTransition:] + 190
17 UIKit                          0x2252965d __86+[UIView(Internal) _transitionFromView:toView:duration:options:animations:completion:]_block_invoke.3648 + 28
18 UIKit                          0x2227bacb -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 434
19 UIKit                          0x2227b597 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 210
20 UIKit                          0x2227b41f -[UIViewAnimationState animationDidStop:finished:] + 128
21 QuartzCore                     0x1fe953df CA::Layer::run_animation_callbacks(void*) + 252
22 libdispatch.dylib              0x1c6e5783 _dispatch_client_callout + 22
23 libdispatch.dylib              0x1c6e9d05 _dispatch_main_queue_callback_4CF + 902
24 CoreFoundation                 0x1cfd3d69 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
25 CoreFoundation                 0x1cfd1e19 __CFRunLoopRun + 848
26 CoreFoundation                 0x1cf251af CFRunLoopRunSpecific + 470
27 CoreFoundation                 0x1cf24fd1 CFRunLoopRunInMode + 104
28 GraphicsServices               0x1e6cfb41 GSEventRunModal + 80
29 UIKit                          0x222a7a53 UIApplicationMain + 150
30 <App>                          0x165cd3 main (main.m:12)
31 libdyld.dylib                  0x1c7124eb start + 2
@belkadan
Copy link
Contributor

@swift-ci create

@belkadan
Copy link
Contributor

Any chance you can post the declaration of the TableSection enum, even if anonymized somewhat?

@swift-ci
Copy link
Collaborator Author

Comment by Michael McGuire (JIRA)

@belkadan Would it be possible to send it to you privately? That shouldn't be a problem.

@belkadan
Copy link
Contributor

Sure. Does https://bugreport.apple.com count? That'll limit it to Apple people, at least, and we can leave it connected to this JIRA bug.

@swift-ci
Copy link
Collaborator Author

Comment by Michael McGuire (JIRA)

Perfect! I'll create it and post the Radar here

@swift-ci
Copy link
Collaborator Author

Comment by Michael McGuire (JIRA)

rdar://problem/41587337

@mikeash
Copy link
Contributor

mikeash commented Jun 28, 2018

Thanks for the radar! I've been looking into a similar crasher and I wonder if it might be the same thing. Would it be possible to post a full crash log (or several, if possible) for these crashes? Or barring that, just the exception info, VM region info, and register states? Feel free to attach them to the radar if you want to keep them private.

@swift-ci
Copy link
Collaborator Author

Comment by Michael McGuire (JIRA)

Absolutely @mikeash. I've copied out every single crash we've received via iTunes Connect that looks anything similar to this, zipped it up and attached to the Radar.

@mikeash
Copy link
Contributor

mikeash commented Jun 28, 2018

How delightfully comprehensive. This definitely looks a lot like the other bug I've been poking at. Unfortunately I haven't actually figured out the fix yet, but it's good to have more examples, and there are some differences in here which may be informative. Anyway, I'll keep at it.

@swift-ci
Copy link
Collaborator Author

Comment by Michael McGuire (JIRA)

Great! Hopefully it wasn't too much 🙂

@mikeash
Copy link
Contributor

mikeash commented Jun 28, 2018

There's no such thing as too many crash logs.

@mikeash
Copy link
Contributor

mikeash commented Jul 11, 2018

I've finally tracked this down. Here's the PR for the fix: #17879

That was a nasty one. Thanks again for your diagnostic info. It was useful to know that the problem went beyond what I was originally examining, and the differences in your crashes did have some hints on what was happening.

@swift-ci
Copy link
Collaborator Author

Comment by Michael McGuire (JIRA)

Awesome @mikeash! Is there anyway we can get this fix into swift-4.2-branch also? Would sure be nice to get rid of this crash in our app come September instead of waiting for next year ;-)

@mikeash
Copy link
Contributor

mikeash commented Jul 12, 2018

But of course! #17880

@swift-ci
Copy link
Collaborator Author

Comment by Michael McGuire (JIRA)

@mikeash amazing, thank you!

thinking back I guess I could have tried that myself 😃

@swift-ci
Copy link
Collaborator Author

Comment by Michael McGuire (JIRA)

An update: we are not seeing this crash anymore after upgrading to Xcode 10.0 with Swift 4.2! Unfortunately our app has become nearly unusable on 32-bit devices. See: https://bugs.swift.org/browse/SR-9256

@mikeash
Copy link
Contributor

mikeash commented Nov 15, 2018

Ouch! I'll take a look at that one too.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software regression run-time crash Bug → crash: Swift code crashed during execution swift 4.1
Projects
None yet
Development

No branches or pull requests

4 participants