Skip to content

Error in LocalTestingDistributedActorSystem.assignID #63679

Open
@dimsumthinking

Description

@dimsumthinking

Description
I'm getting a crash when I create a distributed actor and pass in LocalTestingDistributedActorSystem() as the actor system. I do not see this crash when I tried to create a minimal version of this app to accompany this report so it is likely a problem in my code and not LocalTestingDistributedActorSystem - but I figured it's safer to submit it so you can see it.

Steps to reproduce
Please look at the code in this project:https://github.com/editorscut/ec013async/tree/main/TempFilesForBugReport/CrashingExample/AppIcons

In Controllers/AppStore I create an instance of the distributed actor Searcher and pass in LocalTestingDistributedActorSystem() as the Actor System.

The app crashes if in the init in Searcher I set self.actorSystem = actorSystem (the passed in value) but does not crash if I ignore the passed in value and set self.actorSystem = LocalTestingDistributedActorSystem() (i.e. a newly created instance).

The backtrace shows an os_unfair_lock_corruption_abort that seems to come from LocalTestingDistributedActorSystem.assignID.

As a contrast, I've created a minimal version of this app that creates a distributed actor in the same way and it seems to work fine. The minimal example is https://github.com/editorscut/ec013async/tree/main/TempFilesForBugReport/MinimalExampleForBugReport

Noting that the backtrace shows the problem occurs on the main thread, I found that if I move the creation of the distributed actor off of the main actor that I don't see the crash. https://github.com/editorscut/ec013async/tree/main/TempFilesForBugReport/OffMainActor/AppIcons

Expected behavior
I would expect to be able to pass in the actor system

Environment
I'm using Xcode 14.2 targeting iOS 16.2.

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwaredistributedFeature → concurrency: distributed actorrun-time crashBug → crash: Swift code crashed during executionstandard libraryArea: Standard library umbrellaswift 5.7

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions