Skip to content

Commit 0ac2853

Browse files
pzhan9facebook-github-bot
authored andcommitted
Add more explanation to missing python actor object error (#366)
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. Reviewed By: mariusae Differential Revision: D77446127
1 parent 96cc0a7 commit 0ac2853

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

python/monarch/actor_mesh.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,21 @@ async def handle_cast(
521521
return None
522522

523523
if self.instance is None:
524+
# This could happen because of the following reasons. Both
525+
# indicates a possible bug in the framework:
526+
# 1. the execution of the previous message for "__init__" failed,
527+
# but that error is not surfaced to the caller.
528+
# - TODO(T229200522): there is a known bug. fix it.
529+
# 2. this message is delivered to this actor before the previous
530+
# message of "__init__" is delivered. Out-of-order delivery
531+
# should never happen. It indicates either a bug in the
532+
# message delivery mechanism, or the framework accidentally
533+
# mixed the usage of cast and direct send.
524534
raise AssertionError(
525-
"__init__ failed earlier and no Actor object is available"
535+
f"""
536+
actor object is missing when executing method {message.method}
537+
on actor {mailbox.actor_id}
538+
"""
526539
)
527540
the_method = getattr(self.instance, message.method)._method
528541

0 commit comments

Comments
 (0)