Lost Remote Error
chiaramdelucia opened this issue · 4 comments
Hello,
I am using zeropc-node on the client side and zerorpc-python on the server side.
The below code gives an error response 'Error: Lost remote after 10000ms'
Server Code
@zerorpc.stream
def stuff(self, num):
for _ in xrange(73):
time.sleep(0.2)
yield num
Client Code
client.invoke('stuff', 42, (error, res, more) => {
if (error) {
console.log(error);
} else if (more) {
console.log(res);
}
});
Any insight would be much appreciated.
Thank you.
And, of course, I find this stackoverflow post AFTER I post my issue. gevent.sleep worked perfectly.
Thanks!
Hi,
I also have the same problem, but I am quite confused about how to use gevent and where to add it. Any help would be appreciated!
Thanks!
gevent gives you cooperative coroutine atop an IO loop. In other words, you have a single thread and many concurrent path of execution.
In order to make progress, you must always yield back the gevent loop, for it to poll IOs, and continue execution to the next pending coroutine.
Because of this you must never hold the CPU for too long (ideally, no more than few 100ms).
time.sleep
(blocking the current thread) becomes gevent.sleep
(schedule current coroutine for later and yield to the gevent loop). subprocess.Popen
would block the thread, but gevent.Popen
will not, etc.