[SR-10526] Runtime crash w/ Swift 5.0 and 5.0.1 - swift_checkMetadataState #52926
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
run-time crash
Bug → crash: Swift code crashed during execution
Environment
macOS 10.14.4, Xcode 10.2.1, iOS simulator 12.2
Additional Detail from JIRA
md5: 15cdba57ea2ecad522ff54dc3b4d8e44
Issue Description:
We are seeing a runtime crash with Swift 5 compiler (in Swift 4.2 mode) that doesn't occur when same code compiled with Swift 4.2 compiler. Its occurring in a unit test module that uses the Quick library when Quick is initialising and making this call:
objc_getClassList(NULL, 0)
Which results in the following stack trace:
Thread 1 Queue : com.apple.main-thread (serial)Thread 1 Queue : com.apple.main-thread (serial)#0 0x00000001224b802f in swift_checkMetadataState ()#1 0x00000001224bbcd6 in bool findAnyTransitiveMetadata<checkTransitiveCompleteness(swift::TargetMetadata<swift::InProcess> const*)::$_14&>(swift::TargetMetadata<swift::InProcess> const*, checkTransitiveCompleteness(swift::TargetMetadata<swift::InProcess> const*)::$_14&) ()#2 0x00000001224bbbbe in checkTransitiveCompleteness(swift::TargetMetadata<swift::InProcess> const*) ()#3 0x00000001224bc9b8 in swift::MetadataCacheEntryBase<(anonymous namespace)::SingletonMetadataCacheEntry, int>::doInitialization(swift::ConcurrencyControl&, swift::MetadataCompletionQueueEntry*, swift::MetadataRequest) ()#4 0x00000001224b2213 in swift_getSingletonMetadata ()#5 0x0000000120852388 in type metadata accessor for MainScheduler ()#6 0x0000000120853c8c in ObjC metadata update function for MainScheduler ()#7 0x0000000106318d7f in realizeClassMaybeSwiftMaybeRelock(objc_class*, mutex_tt<false>&, bool) ()#8 0x000000010630fb98 in realizeAllClasses() ()#9 0x00000001063118f6 in objc_getClassList ()#10 0x000000011e421dd0 in qck_enumerateSubclasses at /Users/markw/UrbanThings/uttransitapi_apple/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m:21#11 0x000000011e422083 in __32+[QuickConfiguration initialize]_block_invoke at /Users/markw/UrbanThings/uttransitapi_apple/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m:74#12 0x0000000108e85d02 in _dispatch_client_callout ()#13 0x0000000108e874ce in _dispatch_once_callout ()#14 0x000000011e422025 in dispatch_once [inlined] at /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.2.sdk/usr/include/dispatch/once.h:84#15 0x000000011e42200a in +[QuickConfiguration initialize] at /Users/markw/UrbanThings/uttransitapi_apple/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m:73#16 0x000000010630c698 in CALLING_SOME+initialize_METHOD ()#17 0x000000010630ca2a in initializeNonMetaClass ()#18 0x000000010630d54f in initializeAndMaybeRelock(objc_class*, objc_object*, mutex_tt<false>&, bool) ()#19 0x00000001063133e2 in lookUpImpOrForward ()#20 0x00000001063210d4 in objc_msgSend_uncached ()#21 0x000000011e42224f in +[QuickSpec initialize] at /Users/markw/UrbanThings/uttransitapi_apple/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.m:29#22 0x000000010630c698 in CALLING_SOME+initialize_METHOD ()#23 0x000000010630ca2a in initializeNonMetaClass ()#24 0x000000010630c969 in initializeNonMetaClass ()#25 0x000000010630d54f in initializeAndMaybeRelock(objc_class*, objc_object*, mutex_tt<false>&, bool) ()#26 0x00000001063133e2 in lookUpImpOrForward ()#27 0x00000001063210d4 in _objc_msgSend_uncached ()#28 0x0000000105ba9d41 in -[NSBundle loadAndReturnError:] ()#29 0x000000010620223d in _XCTestMain ()#30 0x0000000105880cb9 in main ()#31 0x0000000108ef3541 in start ()#32 0x0000000108ef3541 in start ()
Since this doesn't occur with all our unit test modules based around Quick there is something more subtle but to provide a complete case to reproduce would be involved (but can do if needed).
The text was updated successfully, but these errors were encountered: