Skip to content
This repository has been archived by the owner on Jul 2, 2023. It is now read-only.

SingleCollectionViewProvider<Cell: UICollectionViewCell> Does not conform protocol UniqueAnimatableCollectionViewProvider - Swift compiler error segmentation fault 11 #29

Open
10000TB opened this issue Sep 16, 2019 · 11 comments

Comments

@10000TB
Copy link

10000TB commented Sep 16, 2019

SingleCollectionViewProvider<Cell: UICollectionViewCell> Does not conform protocol "UniqueAnimatableCollectionViewProvider" in UniqueCustomCollectionViewProvider.swift - it used compile with no problem, any idea on why this is happening lately on 2.0.0 release ? @DianQK

Screen Shot 2019-09-15 at 20 31 14

@10000TB 10000TB changed the title SingleCollectionViewProvider<Cell: UICollectionViewCell> Does not conform protocol SingleCollectionViewProvider<Cell: UICollectionViewCell> Does not conform protocol UniqueAnimatableCollectionViewProvider Sep 16, 2019
@10000TB
Copy link
Author

10000TB commented Sep 16, 2019

On a separate node (in case this is related) - After I "fixed" the protocol conformation issue, Flix will failed to compile in xcode 10.3 & swift 4.2 with a segmentation fault 11:

CompileSwift normal arm64 /Users/<username>/<project_name>/<projectname>-iOS/<folder1>/<folder2>/ThirdParty/Flix-3.0.0/TableViewEdit/TableViewInsertable.swift
    cd /Users/<username>/<project_name>/<projectname>-iOS/<folder1>
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -filelist /var/folders/fx/0fq_v8h53qqfzh44vdkxx7640000gn/T/sources-e90f24 -primary-file ....

(skipping sensitive info)

---
2.	While emitting IR SIL function "@$s9what2eats13RadioProviderCyqd__GAA033AnimatableCollectionViewMultiNodeC0A2aEP06createD5Nodes7RxSwift10ObservableCySayAA012IdentifiableH0VGGyFTW".
 for 'createAnimatableNodes()' (at /Users/xuehaodavidhu/what2eats/what2eats-iOS/what2eats/what2eats/ThirdParty/Flix-3.0.0/Provider/CollectionViewProvider.swift:190:12)
0  swift                    0x000000010aa3dee3 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x000000010aa3d6bc SignalHandler(int) + 348
2  libsystem_platform.dylib 0x00007fff77d06b5d _sigtramp + 29
3  libsystem_platform.dylib 0x00007f8fe0b44758 _sigtramp + 1759763480
4  swift                    0x00000001068eaee1 swift::irgen::FulfillmentMap::searchWitnessTable(swift::irgen::IRGenModule&, swift::CanType, swift::ProtocolDecl*, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>*) + 65
5  swift                    0x00000001068eae52 swift::irgen::FulfillmentMap::searchWitnessTable(swift::irgen::IRGenModule&, swift::CanType, swift::ProtocolDecl*, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&) + 450
6  swift                    0x00000001068eac58 void llvm::function_ref<void (unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>)>::callback_fn<swift::irgen::FulfillmentMap::searchNominalTypeMetadata(swift::irgen::IRGenModule&, swift::CanType, swift::MetadataState, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&)::$_1>(long, unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>) + 1656
7  swift                    0x0000000106a3b77f swift::irgen::GenericTypeRequirements::enumerateFulfillments(swift::irgen::IRGenModule&, swift::SubstitutionMap, llvm::function_ref<void (unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>)>) + 335
8  swift                    0x00000001068e9e0a swift::irgen::FulfillmentMap::searchNominalTypeMetadata(swift::irgen::IRGenModule&, swift::CanType, swift::MetadataState, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&) + 490
9  swift                    0x00000001068e9be8 swift::irgen::FulfillmentMap::searchTypeMetadata(swift::irgen::IRGenModule&, swift::CanType, swift::irgen::IsExact_t, swift::MetadataState, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&) + 952
10 swift                    0x0000000106ae83aa swift::irgen::IRGenFunction::bindLocalTypeDataFromTypeMetadata(swift::CanType, swift::irgen::IsExact_t, llvm::Value*, swift::MetadataState) + 314
11 swift                    0x0000000106a39114 swift::irgen::emitPolymorphicParameters(swift::irgen::IRGenFunction&, swift::SILFunction&, swift::irgen::Explosion&, swift::irgen::WitnessMetadata*, llvm::function_ref<llvm::Value* (unsigned int)> const&) + 580
12 swift                    0x0000000106aa01c1 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 8049
13 swift                    0x000000010695f379 swift::irgen::IRGenerator::emitLazyDefinitions() + 1353
14 swift                    0x0000000106a80360 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1232
15 swift                    0x00000001068a21c9 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 49433
16 swift                    0x00000001068927de swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6862
17 swift                    0x000000010683087e main + 1246
18 libdyld.dylib            0x00007fff77b1b3d5 start + 1

@10000TB
Copy link
Author

10000TB commented Sep 19, 2019

Ok, looks like this is not going to get authors' attention any time soon

But for the record, want to share my debug findings anyway, in case other people also using this is scrambling their head trying to fix the same thing.

  1. Examples of from major releases of this project does not build
    Most of them failed at some protocol conformation issue, exactly like I posted above.

  2. Release 2.0.0 is having swift compiler crash issue (Xcode 10.2 & 10.3)
    They all appear to throw core dump as I posted above - could not figure out a fix to that - actually could not reason why it happened at first place, hope the author may have some clue when he noticed this thread @DianQK

  3. Release 4.0.0 dose not seem to build - some xconfig file issue

@DianQK
Copy link
Owner

DianQK commented Sep 19, 2019

Hi, @10000TB this error has fixed on 3.0.0. See 0734313#diff-7c7e5b8536101ffa202058a30b0416b9R86 .

I'm not sure why cause "segmentation fault 11", look like Swift's bug.

@DianQK
Copy link
Owner

DianQK commented Sep 19, 2019

Or you can use this branch https://github.com/DianQK/Flix/tree/release/2.0.1. I cannot build this for iOS 9 with Xcode 10, and I'm not sure why "Flix did not pass validation" for pod lint.

@10000TB
Copy link
Author

10000TB commented Sep 20, 2019

@DianQK To your first response - just verified that 3.0.0 does fix the protocol conformation issue (which seems to add onUpdate(..) right before configureCell(...)). but it still gives segmentation fault like following, and it looks like for 'createAnimatableNodes()' (in module 'Flix') is to blame:

Users/xuehaodavidhu/what2eats/what2eats-iOS/what2eats/what2eats/Views/OneGraySeparationThickCell.swift
/Users/xuehaodavidhu/what2eats/what2eats-iOS/what2eats/what2eats/Views/DishPostHeaderCell.swift
---
2.	While emitting IR SIL function "@$s9what2eats13RadioProviderCyqd__G4Flix033AnimatableCollectionViewMultiNodeC0AaeFP06createE5Nodes7RxSwift10ObservableCySayAE012IdentifiableI0VGGyFTW".
 for 'createAnimatableNodes()' (in module 'Flix')
0  swift                    0x000000010d4e3ee3 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x000000010d4e36bc SignalHandler(int) + 348
2  libsystem_platform.dylib 0x00007fff74fc7b5d _sigtramp + 29
3  libsystem_platform.dylib 0x00007f86935add68 _sigtramp + 509501992
4  swift                    0x0000000109390ee1 swift::irgen::FulfillmentMap::searchWitnessTable(swift::irgen::IRGenModule&, swift::CanType, swift::ProtocolDecl*, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&, llvm::SmallPtrSetImpl<swift::ProtocolDecl*>*) + 65
5  swift                    0x0000000109390e52 swift::irgen::FulfillmentMap::searchWitnessTable(swift::irgen::IRGenModule&, swift::CanType, swift::ProtocolDecl*, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&) + 450
6  swift                    0x0000000109390c58 void llvm::function_ref<void (unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>)>::callback_fn<swift::irgen::FulfillmentMap::searchNominalTypeMetadata(swift::irgen::IRGenModule&, swift::CanType, swift::MetadataState, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&)::$_1>(long, unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>) + 1656
7  swift                    0x00000001094e177f swift::irgen::GenericTypeRequirements::enumerateFulfillments(swift::irgen::IRGenModule&, swift::SubstitutionMap, llvm::function_ref<void (unsigned int, swift::CanType, llvm::Optional<swift::ProtocolConformanceRef>)>) + 335
8  swift                    0x000000010938fe0a swift::irgen::FulfillmentMap::searchNominalTypeMetadata(swift::irgen::IRGenModule&, swift::CanType, swift::MetadataState, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&) + 490
9  swift                    0x000000010938fbe8 swift::irgen::FulfillmentMap::searchTypeMetadata(swift::irgen::IRGenModule&, swift::CanType, swift::irgen::IsExact_t, swift::MetadataState, unsigned int, swift::irgen::MetadataPath&&, swift::irgen::FulfillmentMap::InterestingKeysCallback const&) + 952
10 swift                    0x000000010958e3aa swift::irgen::IRGenFunction::bindLocalTypeDataFromTypeMetadata(swift::CanType, swift::irgen::IsExact_t, llvm::Value*, swift::MetadataState) + 314
11 swift                    0x00000001094df114 swift::irgen::emitPolymorphicParameters(swift::irgen::IRGenFunction&, swift::SILFunction&, swift::irgen::Explosion&, swift::irgen::WitnessMetadata*, llvm::function_ref<llvm::Value* (unsigned int)> const&) + 580
12 swift                    0x00000001095461c1 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 8049
13 swift                    0x0000000109405379 swift::irgen::IRGenerator::emitLazyDefinitions() + 1353
14 swift                    0x0000000109526360 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1232
15 swift                    0x00000001093481c9 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 49433
16 swift                    0x00000001093387de swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6862
17 swift                    0x00000001092d687e main + 1246
18 libdyld.dylib            0x00007fff74ddc3d5 start + 1
19 libdyld.dylib            0x0000000000000172 start + 233427702

@10000TB
Copy link
Author

10000TB commented Sep 20, 2019

@DianQK (Follow up from above - same using 3.0.0 branch) on a separate note, for the crash/swift compiler error

Adding this piece code into RadioProvider.swift magically solved the segmentation fault !!!!!!!!

    func createAnimatableNodes() -> Observable<[IdentifiableNode]> {
        let providerIdentity = self._flix_identity
        return createValues()
            .map { $0.map { IdentifiableNode(providerIdentity: providerIdentity, valueNode: $0) } }
    }

(code borrowed from 2.0.1 release branch)

@10000TB 10000TB closed this as completed Sep 20, 2019
@10000TB 10000TB reopened this Sep 20, 2019
@10000TB
Copy link
Author

10000TB commented Sep 20, 2019

(Accidentally clicked close - reopened it for @DianQK to make a decision on this)

@10000TB 10000TB changed the title SingleCollectionViewProvider<Cell: UICollectionViewCell> Does not conform protocol UniqueAnimatableCollectionViewProvider SingleCollectionViewProvider<Cell: UICollectionViewCell> Does not conform protocol UniqueAnimatableCollectionViewProvider - Swift compiler error segmentation fault 11 Sep 20, 2019
@10000TB
Copy link
Author

10000TB commented Sep 20, 2019

(Also updated title to include segmentation fault, hope that will direct people here when they ran into same issue in the description)

@10000TB
Copy link
Author

10000TB commented Sep 20, 2019

For the linting issue - not sure what it is - but does not sound like a blocker if it is just style check

@DianQK DianQK pinned this issue Sep 20, 2019
@DianQK
Copy link
Owner

DianQK commented Sep 20, 2019

I add some workaround methods. see #30 .

@10000TB
Copy link
Author

10000TB commented Sep 20, 2019

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants