Skip to content
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

on_failure for proxy #63

dastultz opened this issue Nov 13, 2015 · 5 comments


None yet
4 participants
Copy link

commented Nov 13, 2015

Hello, I have found little need to use on_receive with the great proxy feature. However I have found the following. Consider this code:

class MyActor(pykka.ThreadingActor):

    def __init__(self):
        super(MyActor, self).__init__()
        self.use_daemon_thread = True

    def on_receive(self, message):

    def execute(self):

    def on_failure(self, exception_type, exception_value, traceback):
        print("**MyActor.on_failure(%s, %s, %s" %(exception_type, exception_value, traceback))

actor_ref = MyActor.start()
#actor_ref.tell({"foo" : "bar"}) # this gives desired behavior (call to on_failure)
p = actor_ref.proxy()
future = p.execute() # this does not call on_failure
future.get() # raises exception

The commented code (foo/bar) fails due to the method not existing and calls on_failure as desired. But the call to p.execute() does not call on_failure. This is because execute() called through the proxy returns a future and one must call get() on the future to access the exception. This seems quite appropriate for "ask" style messaging, but for "tell" style it is cumbersome. I want to "send and forget" messages. I don't want my routine to block while waiting for the message to be processed.

Is there a better way to use proxies with a "failure handler" without blocking, or do I have to fall back on standard tell/ask/on_receive?


@jodal jodal added the enhancement label Nov 15, 2015


This comment has been minimized.

Copy link

commented Nov 15, 2015

There's currently no way to have a generic failure handler with proxies, as all requests from proxies uses "ask" style messages. However, I think this is a feature worth considering.


This comment has been minimized.

Copy link

commented Nov 15, 2015

Ok, thanks. In the meantime I'll see if I can hook in to the logging system to detect errors. I'll leave this open if you want to use it to track the feature request. Close it if you wish.

mylokin added a commit to mylokin/pykka that referenced this issue Apr 8, 2017


This comment has been minimized.

Copy link

commented Jul 27, 2017

Any update on this??? I'm facing the same use case. Any known workaround (except not using proxy)? Thanks

Edit: just saw the pull request, hope that fixes the issue and will make it into Pykka


This comment has been minimized.

Copy link

commented Aug 30, 2017

Same issue here.

Any idea how one would go about implementing this? It's quite problematic for us - we've set up a monitoring actor to handle any uncaught tell(), just to get blocked by the exception swallowing proxy. ;(

@jodal jodal added this to the v2.0 milestone Jan 28, 2019

@jodal jodal closed this in 5752c15 Mar 10, 2019


This comment has been minimized.

Copy link

commented Mar 10, 2019

Pykka 2.0 will include a defer() method, like in PR #72, to call a proxy method with tell semantics. Any exceptions raised will then be handled by the actor's on_failure().

See for docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.