-
Notifications
You must be signed in to change notification settings - Fork 58
gevent error when using accross threads #51
Comments
+1
Moreover, if I understand correctly, client part is not thread-safe at all: Line 138 in d7674c0
It creates one socket per all threads. If few threads writes at the same time, a response might be read by wrong one. Tell me please if I'm wrong. |
I'm running into this error too. Is there any workaround other than keeping the client on the main thread and using message-passing between threads to coordinate calls (which seems like a huge pain)? |
@wbthomason |
@wosiu Got it, thanks! I'd incidentally also tried using And yeah, my case necessitates some sort of RPC, unfortunately. Thanks for the info! |
I am not sure that I understand this issue correctly, but the current implementation of |
Hi !
I am using mprpc in a large-ish code base, and it might happen that sometimes rpc calls are made from another thread than the main. Is there anything I can do about this ? This is giving the following error :
File "mprpc/client.pyx", line 138, in mprpc.client.RPCClient.call (mprpc/client.c:2545) data = self._socket.recv(SOCKET_RECV_SIZE) File "D:\_DEV_GIT\avPipe_GIT\avPipe\Dependencies\PyLibraries\MSVC14\gevent\_socket2.py", line 295, in recv self._wait(self._read_event) File "src/gevent/_hub_primitives.py", line 265, in gevent.__hub_primitives.wait_on_socket File "src/gevent/_hub_primitives.py", line 266, in gevent.__hub_primitives.wait_on_socket File "src/gevent/_hub_primitives.py", line 252, in gevent.__hub_primitives._primitive_wait File "src/gevent/_hub_primitives.py", line 46, in gevent.__hub_primitives.WaitOperationsGreenlet.wait File "src/gevent/_hub_primitives.py", line 46, in gevent.__hub_primitives.WaitOperationsGreenlet.wait File "src/gevent/_hub_primitives.py", line 55, in gevent.__hub_primitives.WaitOperationsGreenlet.wait 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 error: cannot switch to a different thread
Thanks !
The text was updated successfully, but these errors were encountered: