Redesign actor_addr as value type - #2409
Draft
Neverlord wants to merge 1 commit into
Draft
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2409 +/- ##
==========================================
- Coverage 73.12% 73.01% -0.12%
==========================================
Files 635 637 +2
Lines 30525 30559 +34
Branches 3343 3353 +10
==========================================
- Hits 22322 22313 -9
- Misses 6289 6331 +42
- Partials 1914 1915 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Neverlord
force-pushed
the
gh-2397-actor-addr-redesign
branch
2 times, most recently
from
May 3, 2026 09:03
26449e4 to
793424d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 46 out of 46 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The only purpose of `actor_addr` is to select actor handles that are
stored as either `actor` or `typed_actor<...>`. However, internally it
holds a weak pointer to the actor. At this point, only for historic
reasons.
While holding a weak pointer internally works in a single-process
setting, this design breaks in a distributed system. Sending a weak
pointer is deeply problematic:
- remote nodes hold *strong* references to actors they are communicating
with; once the remote actor terminates this reference will be dropped
automatically from the registry
- when receiving a weak pointer to an unknown actor, there is no
sensible thing the receiver might do other than discarding it:
* creating a proxy would immediately expire the object again
* there might exist weak references to the old proxy, creating a new
one would mean those pointer would be unequal even though they
represent the same actor
* storing weak references in the registry would only introduce new
problems w.r.t. proxy lifetimes, etc.
Since the purpose of `actor_addr` is to identify terminated actors in an
`exit_msg` or `down_msg`, the much cleaner, safe alternative is to
re-implement it as a simple value type holding an `actor_id` and a
`node_id`: these two IDs uniquely and unambiguously identify any actor
in a distributed CAF system.
Further, sending weak pointers is fundamentally unsafe. Hence, we also
remove the type ID for `weak_actor_ptr` and remove support for it from
the serialization API.
Neverlord
force-pushed
the
gh-2397-actor-addr-redesign
branch
from
May 3, 2026 09:29
793424d to
6ba4690
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The only purpose of
actor_addris to select actor handles that are stored as eitheractorortyped_actor<...>. However, internally it holds a weak pointer to the actor. At this point, only for historic reasons.While holding a weak pointer internally works in a single-process setting, this design breaks in a distributed system. Sending a weak pointer is deeply problematic:
Since the purpose of
actor_addris to identify terminated actors in anexit_msgordown_msg, the much cleaner, safe alternative is to re-implement it as a simple value type holding anactor_idand anode_id: these two IDs uniquely and unambiguously identify any actor in a distributed CAF system.Since sending weak pointers is fundamentally unsafe, we also remove the type ID for
weak_actor_ptr.