Skip to content

Compiler crash on incorrect (non-existent) distributed actor declaration #58663

Open
@mr-swifter

Description

@mr-swifter

Describe the bug
I use snapshot of trunk development for 4th of May 2022. When I compile simple code with distributed actors I've got a crash

Stacktrace:

1.	Apple Swift version 5.7-dev (LLVM cd62c186b914a47, Swift c58d4dba34ef37a)
2.	Compiling with the current language version
3.	While evaluating request TypeCheckSourceFileRequest(source_file "/Users/ordo/Dev/Server/DistributedActorsCrash/Sources/DistributedActorsPlayground/DataActors.swift")
4.	While evaluating request TypeCheckFunctionBodyRequest(DistributedActorsPlayground.(file).Server.send())
5.	While evaluating request ParseAbstractFunctionBodyRequest(DistributedActorsPlayground.(file).Server.send())
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           0x0000000109281be8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000109280e48 llvm::sys::RunSignalHandlers() + 128
2  swift-frontend           0x000000010928224c SignalHandler(int) + 304
3  libsystem_platform.dylib 0x00000001aed854c4 _sigtramp + 56
4  libsystem_pthread.dylib  0x00000001aed6dee0 pthread_kill + 288
5  libsystem_c.dylib        0x00000001aeca8340 abort + 168
6  libsystem_c.dylib        0x00000001aeca7754 err + 0
7  swift-frontend           0x00000001095a3f94 deriveBodyDistributed_thunk(swift::AbstractFunctionDecl*, void*) (.cold.6) + 0
8  swift-frontend           0x00000001058e6c54 deriveBodyDistributed_thunk(swift::AbstractFunctionDecl*, void*) + 7936
9  swift-frontend           0x000000010607bf34 swift::ParseAbstractFunctionBodyRequest::evaluate(swift::Evaluator&, swift::AbstractFunctionDecl*) const + 320
10 swift-frontend           0x0000000105e48038 llvm::Expected<swift::ParseAbstractFunctionBodyRequest::OutputType> swift::Evaluator::getResultUncached<swift::ParseAbstractFunctionBodyRequest>(swift::ParseAbstractFunctionBodyRequest const&) + 404
11 swift-frontend           0x0000000105e47d38 llvm::Expected<swift::ParseAbstractFunctionBodyRequest::OutputType> swift::Evaluator::getResultCached<swift::ParseAbstractFunctionBodyRequest, (void*)0>(swift::ParseAbstractFunctionBodyRequest const&) + 116
12 swift-frontend           0x0000000105da8e98 swift::ParseAbstractFunctionBodyRequest::OutputType swift::evaluateOrDefault<swift::ParseAbstractFunctionBodyRequest>(swift::Evaluator&, swift::ParseAbstractFunctionBodyRequest, swift::ParseAbstractFunctionBodyRequest::OutputType) + 56
13 swift-frontend           0x0000000105d8b4a4 swift::AbstractFunctionDecl::getBody(bool) const + 212
14 swift-frontend           0x0000000105a78640 swift::TypeCheckFunctionBodyRequest::evaluate(swift::Evaluator&, swift::AbstractFunctionDecl*) const + 208
15 swift-frontend           0x0000000105e49da0 llvm::Expected<swift::TypeCheckFunctionBodyRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckFunctionBodyRequest>(swift::TypeCheckFunctionBodyRequest const&) + 404
16 swift-frontend           0x0000000105e49b24 llvm::Expected<swift::TypeCheckFunctionBodyRequest::OutputType> swift::Evaluator::getResultCached<swift::TypeCheckFunctionBodyRequest, (void*)0>(swift::TypeCheckFunctionBodyRequest const&) + 140
17 swift-frontend           0x0000000105da9048 swift::TypeCheckFunctionBodyRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckFunctionBodyRequest>(swift::Evaluator&, swift::TypeCheckFunctionBodyRequest, swift::TypeCheckFunctionBodyRequest::OutputType) + 52
18 swift-frontend           0x0000000105aa5aec swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*) const + 308
19 swift-frontend           0x0000000105aa7900 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckSourceFileRequest>(swift::TypeCheckSourceFileRequest const&) + 400
20 swift-frontend           0x0000000105aa76a0 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultCached<swift::TypeCheckSourceFileRequest, (void*)0>(swift::TypeCheckSourceFileRequest const&) + 124
21 swift-frontend           0x0000000105aa58ac swift::TypeCheckSourceFileRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckSourceFileRequest>(swift::Evaluator&, swift::TypeCheckSourceFileRequest, swift::TypeCheckSourceFileRequest::OutputType) + 44
22 swift-frontend           0x0000000104dfdedc bool llvm::function_ref<bool (swift::SourceFile&)>::callback_fn<swift::CompilerInstance::performSema()::$_7>(long, swift::SourceFile&) + 16
23 swift-frontend           0x0000000104dfa39c swift::CompilerInstance::forEachFileToTypeCheck(llvm::function_ref<bool (swift::SourceFile&)>) + 76
24 swift-frontend           0x0000000104dfa324 swift::CompilerInstance::performSema() + 76
25 swift-frontend           0x0000000104dabea8 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 60
26 swift-frontend           0x0000000104da0b50 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3388
27 swift-frontend           0x0000000104c98cfc swift::mainEntry(int, char const**) + 3748
28 dyld                     0x0000000111ae5088 start + 516
error: Abort trap: 6 (in target 'DistributedActorsPlayground' from project 'DistributedActorsPlayground')

To Reproduce
Steps to reproduce the behavior:

  1. Create empty package
  2. Add settings to enable distributed actors functionality
            swiftSettings: [
                .unsafeFlags(["-Xfrontend", "-enable-experimental-distributed"])
            ]

  1. Declare distributed actor with non-existing DistributedActorSystem
@available(macOS 9999, *)
distributed actor Server {
    
    typealias ActorSystem = DataSystem
    
    typealias SerializationRequirement = Codable
    
    distributed func send() {
        
    }
    
}
  1. Compile...

Expected behavior
Compilation error highlights that declared DistributedActorSystem doesn't exist

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [macOS 12.3]
  • Swift version:
~/Dev/Server/ /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2022-05-04-a.xctoolchain/usr/bin/swift --version
Apple Swift version 5.7-dev (LLVM cd62c186b914a47, Swift c58d4dba34ef37a)
Target: arm64-apple-macosx12.0

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.distributedFeature → concurrency: distributed actor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions