apple / swift-distributed-actors

Peer-to-peer cluster implementation for Swift Distributed Actors
https://apple.github.io/swift-distributed-actors/
Apache License 2.0
580 stars 54 forks source link

Prevent distributed singletons created during other's init from duping IDs #1132

Closed ktoso closed 12 months ago

ktoso commented 1 year ago

Motivation:

We need to "consume" the sneaky way we sneak in the "use this ID" into assignID. Without this we'd assign the same ID if someone were to create a singleton DURING the init() of another singleton.

I need to work around a few aggressive assertions that are trying to prevent users doing bad stuff that we actually do want to do here, but this'll work ok.

Modifications:

We "consume" the "props for spawn" during assignID as it should be. This works because that's code generated as first thing in every distributed actor init.

Result:

resolves #1131 rdar://112434926

relates to rdar://112433423 which is about a language feature to enable control over this properly.

ktoso commented 12 months ago

Just one of the jobs had a timeout https://github.com/apple/swift-distributed-actors/issues/1133 failure