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

Xcode 13.3 Segmentation fault: 11 #7654

Closed
erdemildiz opened this issue Feb 5, 2022 · 13 comments · Fixed by #7672
Closed

Xcode 13.3 Segmentation fault: 11 #7654

erdemildiz opened this issue Feb 5, 2022 · 13 comments · Fixed by #7672

Comments

@erdemildiz
Copy link

erdemildiz commented Feb 5, 2022

How frequently does the bug occur?

All the time

Description

I am using xcode-beta 13.3 version and realm-swift latest version. But I can't build my project, getting below error.

1.	Apple Swift version 5.6 (swiftlang-5.6.0.320.8 clang-1316.0.18.8)
2.	Compiling with the current language version
3.	While evaluating request TypeCheckSourceFileRequest(source_file "/Users/erdemildiz/Desktop/Mitup/mitup-native/Pods/RealmSwift/RealmSwift/LinkingObjects.swift")
4.	While type-checking 'LinkingObjects' (at /Users/erdemildiz/Desktop/Mitup/mitup-native/Pods/RealmSwift/RealmSwift/LinkingObjects.swift:36:16)
5.	While type-checking protocol conformance to 'RealmCollectionImpl' (at /Users/erdemildiz/Desktop/Mitup/mitup-native/Pods/RealmSwift/RealmSwift/Impl/RealmCollectionImpl.swift:30:10) for type 'LinkingObjects<Element>' (declared at [/Users/erdemildiz/Desktop/Mitup/mitup-native/Pods/RealmSwift/RealmSwift/LinkingObjects.swift:36:16 - line:94:1] RangeText="struct LinkingObjects<Element: ObjectBase & RealmCollectionValue>: RealmCollectionImpl {
    // MARK: Initializers

    /**
     Creates an instance of a `LinkingObjects`. This initializer should only be called when declaring a property on a
     Realm model.

     - parameter type:         The type of the object owning the property the linking objects should refer to.
     - parameter propertyName: The property name of the property the linking objects should refer to.
     */
    public init(fromType _: Element.Type, property propertyName: String) {
        self.propertyName = propertyName
    }

    /// A human-readable description of the objects represented by the linking objects.
    public var description: String {
        if realm == nil {
            var this = self
            return withUnsafePointer(to: &this) {
                return "LinkingObjects<\(Element.className())> <\($0)> (\n\n)"
            }
        }
        return RLMDescriptionWithMaxDepth("LinkingObjects", collection, RLMDescriptionMaxDepth)
    }

    // MARK: Object Retrieval

    /**
     Returns the object at the given `index`.

     - parameter index: The index.
     */
    public subscript(index: Int) -> Element {
        if let lastAccessedNames = lastAccessedNames {
            return Element.keyPathRecorder(with: lastAccessedNames)
        }
        throwForNegativeIndex(index)
        return collection[UInt(index)] as! Element
    }

    // MARK: Implementation

    internal init(propertyName: String, handle: RLMLinkingObjectsHandle?) {
        self.propertyName = propertyName
        self.handle = handle
    }
    internal init(collection: RLMCollection) {
        self.propertyName = ""
        self.handle = RLMLinkingObjectsHandle(linkingObjects: collection as! RLMResults<AnyObject>)
    }

    internal var collection: RLMCollection {
        return handle?.results ?? RLMResults<AnyObject>.emptyDetached()
    }

    internal var propertyName: String
    internal var handle: RLMLinkingObjectsHandle?
    internal var lastAccessedNames: NSMutableArray?
")
6.	While evaluating request RequirementSignatureRequest(RealmSwift.(file).RealmCollectionImpl@/Users/erdemildiz/Desktop/Mitup/mitup-native/Pods/RealmSwift/RealmSwift/Impl/RealmCollectionImpl.swift:30:19)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x000000010a6bc9e7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-frontend           0x000000010a6bba38 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x000000010a6bd040 SignalHandler(int) + 288
3  libsystem_platform.dylib 0x00007ff8127e7e2d _sigtramp + 29
4  libsystem_platform.dylib 0x00007fb993853900 _sigtramp + 18446743805291313904
5  swift-frontend           0x000000010685066b swift::RequirementSignatureRequest::evaluate(swift::Evaluator&, swift::ProtocolDecl*) const::$_71::operator()() const + 539
6  swift-frontend           0x000000010684fe8b swift::RequirementSignatureRequest::evaluate(swift::Evaluator&, swift::ProtocolDecl*) const + 155
7  swift-frontend           0x000000010675289a swift::RequirementSignatureRequest::OutputType swift::evaluateOrDefault<swift::RequirementSignatureRequest>(swift::Evaluator&, swift::RequirementSignatureRequest, swift::RequirementSignatureRequest::OutputType) + 1082
8  swift-frontend           0x00000001068d4b35 swift::NormalProtocolConformance::finishSignatureConformances() + 149
9  swift-frontend           0x000000010644e88b swift::MultiConformanceChecker::checkIndividualConformance(swift::NormalProtocolConformance*, bool) + 12571
10 swift-frontend           0x000000010644afd6 swift::MultiConformanceChecker::checkAllConformances() + 182
11 swift-frontend           0x000000010645f34b swift::TypeChecker::checkConformancesInContext(swift::IterableDeclContext*) + 9803
12 swift-frontend           0x000000010640569a swift::ASTVisitor<(anonymous namespace)::DeclChecker, void, void, void, void, void, void>::visit(swift::Decl*) + 9418
13 swift-frontend           0x00000001063ffda9 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 441
14 swift-frontend           0x00000001063ffbe1 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 193
15 swift-frontend           0x00000001064ce837 swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*) const + 567
16 swift-frontend           0x00000001064d1999 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckSourceFileRequest>(swift::TypeCheckSourceFileRequest const&) + 633
17 swift-frontend           0x00000001064ce5b2 swift::performTypeChecking(swift::SourceFile&) + 114
18 swift-frontend           0x00000001055a202d swift::CompilerInstance::performSema() + 285
19 swift-frontend           0x00000001054009ca swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 14234
20 swift-frontend           0x00000001053c0178 swift::mainEntry(int, char const**) + 1064
21 dyld                     0x000000011475a4fe start + 462
22 dyld                     000000000000000000 start + 18446744069071330512
23 swift-frontend           0x000000010536b000 __dso_handle + 0
error: Segmentation fault: 11 (in target 'RealmSwift' from project 'Pods')

Stacktrace & log output

0  swift-frontend           0x000000010a6bc9e7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-frontend           0x000000010a6bba38 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x000000010a6bd040 SignalHandler(int) + 288
3  libsystem_platform.dylib 0x00007ff8127e7e2d _sigtramp + 29
4  libsystem_platform.dylib 0x00007fb993853900 _sigtramp + 18446743805291313904
5  swift-frontend           0x000000010685066b swift::RequirementSignatureRequest::evaluate(swift::Evaluator&, swift::ProtocolDecl*) const::$_71::operator()() const + 539
6  swift-frontend           0x000000010684fe8b swift::RequirementSignatureRequest::evaluate(swift::Evaluator&, swift::ProtocolDecl*) const + 155
7  swift-frontend           0x000000010675289a swift::RequirementSignatureRequest::OutputType swift::evaluateOrDefault<swift::RequirementSignatureRequest>(swift::Evaluator&, swift::RequirementSignatureRequest, swift::RequirementSignatureRequest::OutputType) + 1082
8  swift-frontend           0x00000001068d4b35 swift::NormalProtocolConformance::finishSignatureConformances() + 149
9  swift-frontend           0x000000010644e88b swift::MultiConformanceChecker::checkIndividualConformance(swift::NormalProtocolConformance*, bool) + 12571
10 swift-frontend           0x000000010644afd6 swift::MultiConformanceChecker::checkAllConformances() + 182
11 swift-frontend           0x000000010645f34b swift::TypeChecker::checkConformancesInContext(swift::IterableDeclContext*) + 9803
12 swift-frontend           0x000000010640569a swift::ASTVisitor<(anonymous namespace)::DeclChecker, void, void, void, void, void, void>::visit(swift::Decl*) + 9418
13 swift-frontend           0x00000001063ffda9 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 441
14 swift-frontend           0x00000001063ffbe1 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 193
15 swift-frontend           0x00000001064ce837 swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*) const + 567
16 swift-frontend           0x00000001064d1999 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckSourceFileRequest>(swift::TypeCheckSourceFileRequest const&) + 633
17 swift-frontend           0x00000001064ce5b2 swift::performTypeChecking(swift::SourceFile&) + 114
18 swift-frontend           0x00000001055a202d swift::CompilerInstance::performSema() + 285
19 swift-frontend           0x00000001054009ca swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 14234
20 swift-frontend           0x00000001053c0178 swift::mainEntry(int, char const**) + 1064
21 dyld                     0x000000011475a4fe start + 462
22 dyld                     000000000000000000 start + 18446744069071330512
23 swift-frontend           0x000000010536b000 __dso_handle + 0
error: Segmentation fault: 11 (in target 'RealmSwift' from project 'Pods')

Can you reproduce the bug?

Yes, always

Reproduction Steps

No response

Version

10.22.0

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

macOS Montery, 12.0.1 - xcode 13.3

Build environment

Xcode version: 13.3
macOS Montery, 12.0.1

@seanthegoudarzi
Copy link

Experiencing the same problem

@rowungiles
Copy link

I have also seen this issue on Xcode 13.3 and macOS 12.2.

@ejm01
Copy link
Contributor

ejm01 commented Feb 7, 2022

I believe it's the same as this: https://bugs.swift.org/browse/SR-15792
@leemaguire 's filed a bug with Swift.

Let's keep this issue open for now too.

@lowfreq2010
Copy link

we have the same problem, how do we workaround it until next Xcode beta?

@dianaafanador3
Copy link
Contributor

@lowfreq2010 The bug fix landed in Swift right after the current Xcode beta was released, so the next beta will hopefully include it.

@lowfreq2010
Copy link

@lowfreq2010 The bug fix landed in Swift right after the current Xcode beta was released, so the next beta will hopefully include it.

@dianaafanador3 you will be surprised, but xcode 13.3 beta 3 does not have this problem fixed. It is getting really annoying...

@tgoyne
Copy link
Member

tgoyne commented Feb 25, 2022

They fixed one of the problems, and #7672 works around the other one.

@lowfreq2010
Copy link

They fixed one of the problems, and #7672 works around the other one.

@tgoyne, i did pod update yo install latest version of Realm, but #7672 workaround fix is not there. I've had to manually copy-n-paste line of code into Persistable.swift. And, of course, it is vanished as soon as i do pod install.... How do i make this workaround permanent?

@dianaafanador3
Copy link
Contributor

Hey @lowfreq2010 this fix has been merged but not released yet. We'll release a version within the next few weeks. You can track our releases here.

@jonharris0n
Copy link

I fixed this by changing 'Swift Compiler - Code Generation' settings for 'Optimization Level' to 'No Optimization'. Previously it was optimized for speed. Perhaps a workaround until a fix is issued.

@KaranMehta3984
Copy link

@jonharris0n
It's working fine thanks.

@Jyotiraditya008
Copy link

@jonharris0n
Can you please tell where can i change Swift compiler - Code Generation settings from ' Optimization level ' to ' No Optimization ' . I cant seem to find it
Thank you

@KaranMehta3984
Copy link

@Jrana00
Screenshot 2022-05-14 at 12 47 29 AM

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants