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

Connection hangs with debug logging enabled, causing socket.timeout errors #207

Closed
awlodge opened this Issue Jan 4, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@awlodge

awlodge commented Jan 4, 2017

Running RPyC tip code, the following code doesn't work:

import logging
from rpyc.utils.zerodeploy import DeployedServer
from plumbum.machines.paramiko_machine import ParamikoMachine
from paramiko import AutoAddPolicy

logging.basicConfig(level=logging.DEBUG)

p = ParamikoMachine("localhost", missing_host_policy=AutoAddPolicy())
s = DeployedServer(p)
r = s.classic_connect()

# Configure logging, so that remote logging events are correctly
# passed to the local logger to be handled.
rlogger = r.modules.logging.getLogger()
rlogger.parent=logging.getLogger()

# If this is set to a log level higher than DEBUG, the bug doesn't reproduce.
rlogger.setLevel(logging.DEBUG)
rlogger.addHandler(logging.NullHandler)

It hits a socket.timeout error after 30 seconds:

Traceback (most recent call last):
  File "rpyc_hang_repro.py", line 14, in <module>
    rlogger.addHandler(logging.NullHandler)
  File "/home/rpyc/rpyc/core/netref.py", line 148, in __getattribute__
    return syncreq(self, consts.HANDLE_GETATTR, name)
  File "/home/rpyc/rpyc/core/netref.py", line 71, in syncreq
    return conn.sync_request(handler, oid, *args)
  File "/home/rpyc/rpyc/core/protocol.py", line 467, in sync_request
    raise socket.timeout
socket.timeout

It seems to hang indefinitely, even manually setting SYNC_REQUEST_TIMEOUT in rpyc/core/protocol.py to five minutes hits the same error (after five minutes).

Digging into it, it looks like this is caused by 8c8481a - reverting this commit causes the bug to no longer reproduce.

@coldfix coldfix closed this in 3f1cc1e Jul 28, 2017

coldfix added a commit that referenced this issue Aug 7, 2017

Release rpyc 3.4.4
- Fix refcount leakage when unboxing from cache (#196)
- Fix TypeError when dispatching exceptions on py2 (unicode)
- Respect ``rpyc_protocol_config`` for default Service getattr (#202)
- Support unix domain sockets (#100,#208)
- Use first accessible server in ``connect_by_service`` (#220)
- Fix deadlock problem with logging (#207,#212)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment