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

100% CPU in rpyc 3.4 #218

Closed
liffiton opened this issue Jun 9, 2017 · 6 comments
Closed

100% CPU in rpyc 3.4 #218

liffiton opened this issue Jun 9, 2017 · 6 comments

Comments

@liffiton
Copy link

liffiton commented Jun 9, 2017

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.

@coldfix
Copy link
Contributor

coldfix commented Jun 9, 2017

Thanks, I will investigate this weekend. Can you show a minimal working example?

@liffiton
Copy link
Author

liffiton commented Jun 9, 2017

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.

@liffiton
Copy link
Author

liffiton commented Jun 9, 2017

Okay, here is a minimal working example:

server.py

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()

client.py

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), server.py uses 100% CPU. When run with Python 3.5.2, CPU usage is minimal/negligible.

@coldfix
Copy link
Contributor

coldfix commented Jun 9, 2017

Hi. Seems this issue is fixed with 12544f4.

Can you check with current master whether you still experience problems?

If not, I will release a bugfix release shortly.

@liffiton
Copy link
Author

liffiton commented Jun 9, 2017

Yes, the issue does appear to be fixed after installing rpyc from master. (I had even seen that commit, and I thought I had tried that fix manually... oh well.)

Thanks!

coldfix added a commit that referenced this issue Jun 9, 2017
* Fix issue high-cpu polling (#191,#218)
* Fix filename argument in logging (#197)
* Improved log messages (#191,#204)
* Drop support for python 3.2 and py 2.5
@coldfix
Copy link
Contributor

coldfix commented Jun 9, 2017

Thanks for your report!

Bugfix release 3.4.1 now on PyPI.

@coldfix coldfix closed this as completed Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants