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-12967] Crash in diagnostics system (Swift 5.2) #55413

Open
swift-ci opened this issue Jun 10, 2020 · 7 comments
Open

[SR-12967] Crash in diagnostics system (Swift 5.2) #55413

swift-ci opened this issue Jun 10, 2020 · 7 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-12967
Radar None
Original Reporter Gilbert (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 3c8a6833de10893483babbb2cea0cef5

Issue Description:

Xcode Playgrounds keep failing to compile when I'm importing certain local frameworks (which all work fine otherwise). I traced the issue to a crash with the new Swift diagnostics system.

I see the issue may have been fixed on `github.com/swiftasm` repo, a swift fork, with this commit: swiftwasm@b4c73ab

Not sure if that fixes this bug, but anyway, worth a look.

Along with this crash I often see the following types of errors in ~/Library/CoreSimulator logs:

16:59:24.267079-0700 com.apple.CoreSimulator.SimDevice.1DA2BA65-E0D1-4FF4-9703-BC111A45D6B0 (com.apple.xpc.launchd.domain.pid.searchd.60536) Failed to bootstrap path: path = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim, error = 2: No such file or directory``16:59:23.529597-0700 com.apple.CoreSimulator.SimDevice.1DA2BA65-E0D1-4FF4-9703-BC111A45D6B0 (com.apple.xpc.launchd.domain.pid.AccessibilityUIServer.60532) Failed to bootstrap path: path = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/CoreLocationProtobuf.framework/CoreLocationProtobuf, error = 2: No such file or directory

What's weird about that is, we are linking in Apple's SwiftProtobuf in a dependency of a framework being imported to this Playground. Not sure if it could be related though, since sometimes the Playground compiles and works just fine.

Here is a StackOverflow where I describe all our travails and constant troubles with trying to use Playgrounds in Xcode:

Here's my stacktrace:

Thread 0 Crashed:: Dispatch queue: com.apple.main-threadThread 0 Crashed:: Dispatch queue: com.apple.main-thread0 swift 0x000000010e9c85a5 swift::constraints::MissingConformanceFailure::diagnoseAsError() + 17171 swift 0x000000010e9ba31e swift::constraints::MissingConformance::diagnose(bool) const + 3822 swift 0x000000010e900cf9 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool) + 58493 swift 0x000000010eac41f9 swift::TypeChecker::typeCheckExpressionImpl(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener&, swift::constraints::ConstraintSystem*) + 10334 swift 0x000000010eb93255 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 78935 swift 0x000000010eb90d19 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 1216 swift 0x000000010eb88c6f swift::SimpleRequest<swift::TypeCheckFunctionBodyUntilRequest, bool (swift::AbstractFunctionDecl*, swift::SourceLoc), (swift::CacheKind)1>::evaluateRequest(swift::TypeCheckFunctionBodyUntilRequest const&, swift::Evaluator&) + 28797 swift 0x000000010eb8f4de swift::TypeCheckFunctionBodyUntilRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckFunctionBodyUntilRequest>(swift::Evaluator&, swift::TypeCheckFunctionBodyUntilRequest, swift::TypeCheckFunctionBodyUntilRequest::OutputType) + 7188 swift 0x000000010ebbe21e swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*, unsigned int) const + 62709 swift 0x000000010eb8d4b7 swift::SimpleRequest<swift::TypeCheckSourceFileRequest, bool (swift::SourceFile*, unsigned int), (swift::CacheKind)2>::evaluateRequest(swift::TypeCheckSourceFileRequest const&, swift::Evaluator&) + 2310 swift 0x000000010ebbbb1e swift::performTypeChecking(swift::SourceFile&, unsigned int) + 100611 swift 0x000000010e1f0c12 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t)::$_0::operator()(swift::SourceFile&) const + 6612 swift 0x000000010e1efaef swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 668713 swift 0x000000010dedb9b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 1028114 swift 0x000000010de5cb73 main + 128315 libdyld.dylib 0x00007fff6ceb1cc9 start + 1

@theblixguy
Copy link
Collaborator

Could you provide a reproducer?

@swift-ci
Copy link
Collaborator Author

Comment by Jonathan (JIRA)

Not sure if I can reproduce this problem outside the context of our very complex workspace. If I have time to make that happen then I will, but I might suggest to implement the same fix implemented by `github.com/swiftasm` repo, a swift fork, in this commit: swiftwasm@b4c73ab

I wonder if whoever maintains that repo might be able to provide some details on it this particular issue?

Seems that commit was by @xedin

@xedin
Copy link
Member

xedin commented Jun 10, 2020

Gilbert (JIRA User) Looks like `swiftasm` picked that up from mainline swift, that fix is already included in master. You can use a snapshot of master compiler from swift.org to verify that it fixes this issue in your project.

@swift-ci
Copy link
Collaborator Author

Comment by Jonathan (JIRA)

Thanks @xedin, I am now downloading this guy:

https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2020-06-08-a/swift-DEVELOPMENT-SNAPSHOT-2020-06-08-a-osx.pkg

Once it's finished downloading, I'll try installing that one and see if it seems to fix the issue. Will I also need to install the debug symbols for Xcode and Playgrounds to be happy, or can it work without them?

@swift-ci
Copy link
Collaborator Author

Comment by Jonathan (JIRA)

BTW trying to build w/the snapshot, ran into this bug: https://forums.swift.org/t/undefined-symbol-isosversionatleast/29782/21

Mike Ash's workaround worked, albeit with some modifications.

@swift-ci
Copy link
Collaborator Author

Comment by Jonathan (JIRA)

Well @xedin, sadly, I can't use the latest master compiler snapshot because not only did it throw `Undefined symbol: ___isOSVersionAtLeast` but also, it's missing /usr/lib/libLTO.dylib which we need to compile our app's dependencies.

Any idea why these things are in the normal toolchain but not the one from swift.org?

Also getting build Carthage build errors like "/Users/jonathan.gilbert/code/ios/Carthage/Checkouts/CocoaLumberjack/DerivedData/Lumberjack/Build/Intermediates.noindex/Lumberjack.build/Debug-iphonesimulator/CocoaLumberjack.build/Objects-normal/x86_64/DDOSLogger.dia:1:1: Could not read serialized diagnostics file: Cannot Load File: Failed to open diagnostics file"

Either the latest master compiler is broken or it's missing some key pieces needed for compiling our dependencies. :/

@xedin
Copy link
Member

xedin commented Jun 10, 2020

That's very unfortunate, sounds like we'd have to either wait until new compiler is released or reduce this problem down so it could be tested with a snapshot.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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
Projects
None yet
Development

No branches or pull requests

3 participants