question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

oneway method call followed by _pyroRelease doesn't get called

See original GitHub issue

When a oneway call is followed immediately by _pyroRelease, the server method never gets called. This only occurs with communication over a unix domain socket and seems to be a regression from v5.8 to v5.9. This is an issue for instance when using the Proxy as a context manager when the last call is a oneway call before leaving the context.

An example to reproduce this, adapted from examples/oneway/server2:

Server:

import time
import threading
from Pyro5.api import expose, oneway, behavior, serve, Daemon


@expose
@behavior("single")
class Server(object):
    def __init__(self):
        self.counter = 0

    @oneway
    def increment_oneway(self):
        print("oneway call executing in thread", threading.get_ident())
        time.sleep(0.5)
        self.counter += 1

    def increment(self):
        time.sleep(0.5)
        self.counter += 1

    def getcount(self):
        return self.counter


with Daemon(unixsocket='/Users/samschott/Desktop/example.sock') as daemon:
    daemon.register(Server, "example")
    daemon.requestLoop()

Client:

This won’t work:

from Pyro5.api import Proxy

with Proxy("PYRO:example@./u:/Users/samschott/Desktop/example.sock") as serv:
    serv.increment_oneway()

But giving it some time does work:

import time
from Pyro5.api import Proxy

with Proxy("PYRO:example@./u:/Users/samschott/Desktop/example.sock") as serv:
    serv.increment_oneway()
    time.sleep(0.1)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
irmencommented, Apr 20, 2020

Nice. I’ll fix it properly soon then. Nah, it’s okay, I don’t quite remember the reason why that comment was there about getpeername() but apparently there are situations where it fails. It’s nice when it succeeds but I’m okay with not knowing the client connected in certain error scenarios.

0reactions
samschottcommented, Apr 20, 2020

That solves it! Thanks 😃

Of course, if you would like to always pass the client socket to the error handler, there may be a way to save it when the message is received. I haven’t looked into the code to see how difficult this would be…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tips & Tricks — Pyro 5.14 documentation - Read the Docs
Possible ways to break a cycle are to use a oneway call somewhere in the chain or set an COMMTIMEOUT so that after...
Read more >
PYRO - Features and Guidelines - PythonHosted.org
Any method calls that use mobile code must be normal calls. If you want to use oneway calls, first use a normal call...
Read more >
With Pyro coming with 4.0. That means all of the things ...
Nothing's stopping you from calling in a friend halfway through your mission to help, so why shouldn't NPCs be allowed to as well?...
Read more >
Pyro Documentation - Read the Docs
a few thousand remote method calls per second on a single proxy ... Configuration Pyro can be configured in a lot of ways....
Read more >
c# - How can I find the method that called the current method?
Try this: using System.Diagnostics; // Get call stack StackTrace stackTrace = new StackTrace(); // Get calling method name Console.WriteLine(stackTrace.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found