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-10120] Crash in swift_checkMetadataState or swift_getGenericMetadata #52522

Open
mdiep opened this issue Mar 16, 2019 · 3 comments
Open

[SR-10120] Crash in swift_checkMetadataState or swift_getGenericMetadata #52522

mdiep opened this issue Mar 16, 2019 · 3 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 run-time crash Bug → crash: Swift code crashed during execution

Comments

@mdiep
Copy link
Contributor

mdiep commented Mar 16, 2019

Previous ID SR-10120
Radar None
Original Reporter @mdiep
Type Bug

Attachment: Download

Environment

Happens with both Xcode 10.1 (Swift 4.2.1) and Xcode 10.2b4 (5.0 (swiftlang-1001.0.69 clang-1001.0.45.2))

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

md5: 1169b21e4b3f8318047e3571329d6725

Issue Description:

The attached project will crash when you run the tests. As is, you'll get this crash:

 thread #​1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    frame #​0: 0x00000001082d9b9b libswiftCore.dylib`swift_checkMetadataState + 27
    frame #&#8203;1: 0x0000000101e42717 Pipelines`type metadata completion function for Either at <compiler-generated>:0
    frame #&#8203;2: 0x00000001082dd3ed libswiftCore.dylib`swift::MetadataCacheEntryBase<(anonymous namespace)::GenericCacheEntry, void const*>::doInitialization(swift::ConcurrencyControl&, swift::MetadataCompletionQueueEntry*, swift::MetadataRequest) + 285
    frame #&#8203;3: 0x00000001082d3be4 libswiftCore.dylib`swift_getGenericMetadata + 1476
    frame #&#8203;4: 0x0000000101e42e20 Pipelines`type metadata accessor for Either at <compiler-generated>:0
  * frame #&#8203;5: 0x0000000101e4047e Pipelines`closure #&#8203;1 in Pipeline.select<A, B>(input=0xc000000000000080, executor=0x0000000101e409c0 Pipelines`closure #&#8203;1 (Swift.String, Pipelines.Input) -> ReactiveSwift.SignalProducer<Pipelines.Output, __C.NSError> in Pipelines.Pipeline.run(A) -> ReactiveSwift.SignalProducer<B, __C.NSError> at Pipeline.swift:84, block=0x0000000101e3f950 Pipelines`partial apply forwarder for closure #&#8203;1 (A, (Swift.String, Pipelines.Input) -> ReactiveSwift.SignalProducer<Pipelines.Output, __C.NSError>) -> ReactiveSwift.SignalProducer<A1, __C.NSError> in Pipelines.Pipeline.map<A>((B) -> A1) -> Pipelines.Pipeline<A, A1> at <compiler-generated>, pipeline=Pipelines.Pipeline<τ_1_0, τ_1_1> @ 0x00007ffeefbfd500) at Pipeline.swift:72:6
    frame #&#8203;6: 0x0000000101e4060d Pipelines`partial apply for closure #&#8203;1 in Pipeline.select<A, B>(_:) at <compiler-generated>:0
    frame #&#8203;7: 0x0000000101e41416 Pipelines`Pipeline.run(input="/Users/mdiep/Library/Developer/Xcode/DerivedData/Pipelines-ecctqchlhjoqdogxjgkppgmljxop/Build/Products/Debug/Pipelines.framework", execute=0x0000000101e409c0 Pipelines`closure #&#8203;1 (Swift.String, Pipelines.Input) -> ReactiveSwift.SignalProducer<Pipelines.Output, __C.NSError> in Pipelines.Pipeline.run(A) -> ReactiveSwift.SignalProducer<B, __C.NSError> at Pipeline.swift:84, self=Pipelines.Pipeline<Swift.String, Swift.Array<Swift.String>> @ 0x00007ffeefbfd640) at Pipeline.swift:116:16
    frame #&#8203;8: 0x0000000101e409b4 Pipelines`Pipeline.run(input="/Users/mdiep/Library/Developer/Xcode/DerivedData/Pipelines-ecctqchlhjoqdogxjgkppgmljxop/Build/Products/Debug/Pipelines.framework", self=Pipelines.Pipeline<Swift.String, Swift.Array<Swift.String>> @ 0x00007ffeefbfd6c0) at Pipeline.swift:84:16
    frame #&#8203;9: 0x0000000100ae382e PipelinesTests`PipelinesTests.test(self=0x0000000100b83130) at PipelinesTests.swift:42:25
    frame #&#8203;10: 0x0000000100ae5ba5 PipelinesTests`@objc PipelinesTests.test() at <compiler-generated>:0

If you change the included Either type to be indirect, you'll instead get this crash:

* thread #&#8203;1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    frame #&#8203;0: 0x000000010a2dd139 libswiftCore.dylib`areAllTransitiveMetadataComplete_cheap(swift::TargetMetadata<swift::InProcess> const*)::$_5::operator()(swift::TargetMetadata<swift::InProcess> const*) const + 9
    frame #&#8203;1: 0x000000010a2dd078 libswiftCore.dylib`areAllTransitiveMetadataComplete_cheap(swift::TargetMetadata<swift::InProcess> const*) + 424
    frame #&#8203;2: 0x000000010a2d3b95 libswiftCore.dylib`swift_getGenericMetadata + 1397
    frame #&#8203;3: 0x0000000102742d90 Pipelines`type metadata accessor for Either at <compiler-generated>:0
  * frame #&#8203;4: 0x00000001027406c2 Pipelines`closure #&#8203;1 in Pipeline.select<A, B>(input=0xc000000000000080, executor=0x0000000102740bc0 Pipelines`closure #&#8203;1 (Swift.String, Pipelines.Input) -> ReactiveSwift.SignalProducer<Pipelines.Output, __C.NSError> in Pipelines.Pipeline.run(A) -> ReactiveSwift.SignalProducer<B, __C.NSError> at Pipeline.swift:84, block=0x000000010273fb30 Pipelines`partial apply forwarder for closure #&#8203;1 (A, (Swift.String, Pipelines.Input) -> ReactiveSwift.SignalProducer<Pipelines.Output, __C.NSError>) -> ReactiveSwift.SignalProducer<A1, __C.NSError> in Pipelines.Pipeline.map<A>((B) -> A1) -> Pipelines.Pipeline<A, A1> at <compiler-generated>, pipeline=Pipelines.Pipeline<τ_1_0, τ_1_1> @ 0x00007ffeefbfd500) at Pipeline.swift:72:6
    frame #&#8203;5: 0x000000010274084d Pipelines`partial apply for closure #&#8203;1 in Pipeline.select<A, B>(_:) at <compiler-generated>:0
    frame #&#8203;6: 0x0000000102741616 Pipelines`Pipeline.run(input="/Users/mdiep/Library/Developer/Xcode/DerivedData/Pipelines-ecctqchlhjoqdogxjgkppgmljxop/Build/Products/Debug/Pipelines.framework", execute=0x0000000102740bc0 Pipelines`closure #&#8203;1 (Swift.String, Pipelines.Input) -> ReactiveSwift.SignalProducer<Pipelines.Output, __C.NSError> in Pipelines.Pipeline.run(A) -> ReactiveSwift.SignalProducer<B, __C.NSError> at Pipeline.swift:84, self=Pipelines.Pipeline<Swift.String, Swift.Array<Swift.String>> @ 0x00007ffeefbfd640) at Pipeline.swift:116:16
    frame #&#8203;7: 0x0000000102740bb4 Pipelines`Pipeline.run(input="/Users/mdiep/Library/Developer/Xcode/DerivedData/Pipelines-ecctqchlhjoqdogxjgkppgmljxop/Build/Products/Debug/Pipelines.framework", self=Pipelines.Pipeline<Swift.String, Swift.Array<Swift.String>> @ 0x00007ffeefbfd6c0) at Pipeline.swift:84:16
    frame #&#8203;8: 0x0000000100ae376e PipelinesTests`PipelinesTests.test(self=0x000000010ab0e460) at PipelinesTests.swift:42:25
@mdiep
Copy link
Contributor Author

mdiep commented Mar 16, 2019

Also, very strangely, I left a comment in `PipelinesTests.swift:28` where you can replace one line of code with an equivalent line to remove the error.

@belkadan
Copy link
Contributor

cc @rjmccall, @mikeash

@jshier
Copy link
Contributor

jshier commented Apr 29, 2020

We've started seeing an increase in crash reports to Alamofire for crashes in swift_checkMetadataState, as well as client projects (which shows an issue through tuple metadata). Some are from Xcode 11.3, most from Xcode 11.4 (Swift 5.2 compiler).

@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
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 run-time crash Bug → crash: Swift code crashed during execution
Projects
None yet
Development

No branches or pull requests

4 participants