timeout after 30s
pribadihcr opened this issue · 7 comments
HI,
I got the following error:
zerorpc.exceptions.TimeoutExpired: timeout after 30s
python server:
addr = 'tcp://127.0.0.1:' + parse_port()
s = zerorpc.Server(DetectApi())
s.bind(addr)
print('start running on {}'.format(addr))
s.run()
js client:
const zerorpc = require("zerorpc")
let client = new zerorpc.Client()
client.connect("tcp://127.0.0.1:4242")
Can you provide a more complete example? Along with the output.
I have the same issue.
I have tried with/without heartbeat as well as reverse server/client bind and connect but get the same error. Any ideas?
Server.py
class ExampleServer(object):
def ping(self, i):
print(i)
return (i+1)
server = zerorpc.Server(ExampleServer(), heartbeat=None)
server.bind("tcp://0.0.0.0:4243")
print("Server Started...")
server.run()
Client.py
s = zerorpc.Client(heartbeat=None)
s.connect('tcp://127.0.0.1:4243')
print(s.ping(2))
I get the following error on Client side
File "src/gevent/queue.py", line 329, in gevent._queue.Queue.get
File "src/gevent/queue.py", line 344, in gevent._queue.Queue.get
File "src/gevent/queue.py", line 321, in gevent._queue.Queue.__get_or_peek
File "src/gevent/_waiter.py", line 151, in gevent.__waiter.Waiter.get
File "src/gevent/_greenlet_primitives.py", line 59, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/_greenlet_primitives.py", line 59, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/_greenlet_primitives.py", line 63, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/__greenlet_primitives.pxd", line 35, in gevent.__greenlet_primitives._greenlet_switch
queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".../zerorpc/core.py", line 227, in _process_response
reply_event = bufchan.recv(timeout=timeout)
File ".../zerorpc/channel.py", line 257, in recv
raise TimeoutExpired(timeout)
zerorpc.exceptions.TimeoutExpired: timeout after 30s
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Client.py", line 25, in <module>
print(s.ping(2))
File ".../zerorpc/core.py", line 278, in <lambda>
return lambda *args, **kargs: self(method, *args, **kargs)
File ".../zerorpc/core.py", line 270, in __call__
return self._process_response(request_event, bufchan, timeout)
File ".../zerorpc/core.py", line 230, in _process_response
'calling remote method {0}'.format(request_event.name)))
File ".../zerorpc/core.py", line 224, in raise_error
raise ex
zerorpc.exceptions.TimeoutExpired: timeout after 30s, when calling remote method ping
There is nothing printed on Server side after "Server Started..."
how about the solution? any idea to fix this. i got a same issue.
+1
I found a workaround for this issue:
server.py
class ExampleServer(object):
def ping(self, i):
print(i)
return (i+1)
server = zerorpc.Server(ExampleServer(), heartbeat=None, timeout=None)
server.bind("tcp://0.0.0.0:4243")
print("Server Started...")
server.run()
client.py
s = zerorpc.Client(heartbeat=None)
s.connect('tcp://127.0.0.1:4243')
print(s.ping(2))
in fact I think that this is not a good solution. We should need a solution to not block the server side. Unfortunately i did not find a solution for that