Skip to content

Commit dea1d26

Browse files
pzhan9facebook-github-bot
authored andcommitted
Add more explanation to missing python actor object error
Summary: I hit this error when plumbing `cast` to the python side (D77386342, v1). Briefly, I use `cast` [when mesh is available, and fall back on direct send if not](https://www.internalfb.com/code/fbsource/[D77386342-V1]/fbcode/monarch/python/monarch/actor_mesh.py?lines=192-216). This lead to a mixture usage of `cast` and `direct send` in this test https://www.internalfb.com/code/fbsource/[5ef41e9fdc95c3a2f4f9135244dbb990d0818d0d]/fbcode/monarch/python/meta/tests/test_python_actors.py?lines=256-263 Briefly, `proc.spawn` uses cast, but inside `f.get.stream(t)`, it uses direct send: https://www.internalfb.com/code/fbsource/[5ef41e9fdc95c3a2f4f9135244dbb990d0818d0d]/fbcode/monarch/python/meta/tests/test_python_actors.py?lines=250-253 That is because when `t` gets pickle, `PythonActorMesh` is [not included](https://www.internalfb.com/code/fbsource/[5ef41e9fdc95c3a2f4f9135244dbb990d0818d0d]/fbcode/monarch/python/monarch/actor_mesh.py?lines=153-163). This is very painful to debug. Let us beef up the error message so hopefully I can remember what happened when I run into it next time. Differential Revision: D77446127
1 parent 3ad9b5d commit dea1d26

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

python/monarch/actor_mesh.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,22 @@ async def handle_cast(
522522

523523
if self.instance is None:
524524
raise AssertionError(
525-
"__init__ failed earlier and no Actor object is available"
525+
f"""
526+
Actor object is not available when executing method {message.method}
527+
on actor {mailbox.actor_id}. This could happen because:
528+
1. the execution of previous message for "__init__" failed;
529+
2. this message is delivered to this actor before the previous
530+
message of "__init__" is delivered. Normally out-of-order
531+
delivery should not happen. But it is possible if both
532+
"cast" and "direct actor send" are used. For example
533+
"__init__" is cast, and this message is direct send. Then
534+
this message could be delivered earlier since we do not
535+
guarrantee ordering of delivery interleaved by these 2
536+
usages.
537+
* Since we do not expose the choice of "cast" and "direct
538+
send" to the user, when this error happens, it is
539+
likely a bug in the framework.
540+
"""
526541
)
527542
the_method = getattr(self.instance, message.method)._method
528543

0 commit comments

Comments
 (0)