-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy to self as attribute on actor causes deadlock #48
Comments
Here is the same actor but using message passing. This is working. #! /usr/bin/env python
from pykka import ThreadingFuture, ThreadingActor
def go_command():
actor = NotHungActor.start()
proxy = actor.proxy()
proxy.a()
# actor.stop()
class NotHungActor(ThreadingActor):
def __init__(self):
super(NotHungActor, self).__init__()
proxy = self.actor_ref.proxy()
# print proxy
# self.proxy = proxy
# print "out of constructor"
def on_receive(self, message):
return {
'run': self.run,
'a': self.a,
'b': self.b,
}[message["msg"]]()
def run(self):
print "run"
self.actor_ref.tell({"msg": "a"})
def a(self):
print "a async"
self.actor_ref.tell({"msg": "b"})
def b(self):
print "b async"
if __name__ == '__main__':
# scriptine allows for quick easy scripting
# where this script will run via `corelogic_data.py command`
# commands are any def with {SOME_NAME}_command
import scriptine
scriptine.run() |
I can't immediately see the source of the problem here. I'll have to experiment a bit with this myself. |
I've had similar issue. Instead:
try to use this:
|
Your documentation says that referencing your internal proxy is ideal. This is exactly what I want to do, but it hangs every time. It gets out of the constructor and does nothing. Is this a race condition on proxy (internal vs external)?
Details:
to run:
./crap_actor.py go
The text was updated successfully, but these errors were encountered: