Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
100% CPU in rpyc 3.4 #218
After upgrading to rpyc 3.4, my server process started spinning on the CPU somewhere. Reverting to 3.3 removes the issue entirely.
Specifically, I see ~140% CPU usage when using ThreadedServer, and with ForkingServer, both processes (after forking) use 100% CPU. A bit of profiling pointed to a poll() method as a culprit, but I haven't been able to dig further.
Yes, apologies; I should have done that initially. I'm working on it now, and of course my minimal example works fine... it might take me a bit to identify what aspect of my architecture is triggering the issue.
I have found that the issue occurs when the server is run in Python 2.7.12 but not when it is run in Python 3.5.2 (rpyc 3.4.0 in both cases). And it only occurs after a client connects.
I'll keep working on a minimal example.
Okay, here is a minimal working example:
import rpyc from rpyc.utils.server import ThreadedServer class service(rpyc.Service): def exposed_func(self): print("Hi!") server = ThreadedServer(service, hostname='localhost', port=4158) server.start()
import rpyc import time rpc = rpyc.connect("localhost", 4158) # test to verify connection rpc.root.func() time.sleep(1000)
When run with Python 2.7.12 (Ubuntu 16.04),