Python RPyC服务所有阻塞线程访问连接

Python RPyC服务所有阻塞线程访问连接,python,multithreading,rpyc,Python,Multithreading,Rpyc,在多线程应用程序中,我从线程调用rpyc.Connection.service\u all(),其他线程无法立即使用该连接 我认为serve\u all阻塞了连接,其他线程只有在超时时才能访问它 此代码应重现该问题 服务器: #!/usr/bin/env python3 import rpyc import rpyc.utils.server import threading class Service(rpyc.Service): def on_connect(self):

在多线程应用程序中,我从线程调用
rpyc.Connection.service\u all()
,其他线程无法立即使用该连接

我认为
serve\u all
阻塞了连接,其他线程只有在超时时才能访问它

此代码应重现该问题

服务器:

#!/usr/bin/env python3

import rpyc
import rpyc.utils.server
import threading

class Service(rpyc.Service):
    def on_connect(self):
        print("New connection")

    def on_disconnect(self):
        print("Connection closed")

    def exposed_get_status(self):
        return "Test string"

server = rpyc.utils.server.ThreadedServer(Service, port = 12345)
t = threading.Thread(target = server.start)
t.daemon = True
t.start()
t.join()
客户:

#!/usr/bin/env python3

import rpyc
import threading
import datetime

con = rpyc.connect('localhost',12345)

def delayed():
    print("Time is up")
    now = datetime.datetime.now()
    print(con.root.get_status())
    print(str(datetime.datetime.now() - now))

timer = threading.Timer(10,delayed)

print("Starting timer")
timer.start()
print("serving all")
con.serve_all()
样本输出(来自客户端):

我在安装了pip的Python 3.5.4rc1(debian sid)上使用RPyC 3.4.3

我想我误用了所有的服务,但我在文档中找不到任何东西。

(回答我自己)

我在github上打开了一个应用程序,这似乎很正常。解决方案是对任何资源仅在单个线程上使用执行IO。

(回答我自己)

我在github上打开了一个应用程序,这似乎很正常。解决方案是对任何资源仅在单个线程上使用执行IO

$ python3 testrpyc.py 
Starting timer
serving all
Time is up
Test string
0:01:30.064087