I combined grpc and pika in a Class but I got problem both in client and server of my system when a grpc function in client get start.
The client got grpc Exception calling application, the server got rabbitmq pop from an empty deque.
And I found rabbitmq-server log, client tcp was unexpectedly closed.
Here is traceback of my client:
<code>Traceback (most recent call last):
File "/home/jason/anaconda3/envs/chatroom/lib/python3.9/tkinter/__init__.py", line 1892, in __call__
return self.func(*args)
File "/home/jason/codes/TalkyWalky/login_rpc.py", line 24, in Login
result = self.clientrpc.login()
File "/home/jason/codes/TalkyWalky/client.py", line 28, in login
res = self.stub.myLogin(helloworld_pb2.LoginRequest(username=self.username, password=self.password, queuename=self.queue_name)).res
File "/home/jason/anaconda3/envs/chatroom/lib/python3.9/site-packages/grpc/_channel.py", line 1181, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/home/jason/anaconda3/envs/chatroom/lib/python3.9/site-packages/grpc/_channel.py", line 1006, in _end_unary_response_blocking
raise _InactiveRpcError(state) # pytype: disable=not-instantiable
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "Exception calling application: Stream connection lost: IndexError('pop from an empty deque')"
debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"Exception calling application: Stream connection lost: IndexError('pop from an empty deque')", grpc_status:2, created_time:"2024-06-18T20:12:40.624492156+08:00"}"
</code>
<code>Traceback (most recent call last):
File "/home/jason/anaconda3/envs/chatroom/lib/python3.9/tkinter/__init__.py", line 1892, in __call__
return self.func(*args)
File "/home/jason/codes/TalkyWalky/login_rpc.py", line 24, in Login
result = self.clientrpc.login()
File "/home/jason/codes/TalkyWalky/client.py", line 28, in login
res = self.stub.myLogin(helloworld_pb2.LoginRequest(username=self.username, password=self.password, queuename=self.queue_name)).res
File "/home/jason/anaconda3/envs/chatroom/lib/python3.9/site-packages/grpc/_channel.py", line 1181, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/home/jason/anaconda3/envs/chatroom/lib/python3.9/site-packages/grpc/_channel.py", line 1006, in _end_unary_response_blocking
raise _InactiveRpcError(state) # pytype: disable=not-instantiable
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "Exception calling application: Stream connection lost: IndexError('pop from an empty deque')"
debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"Exception calling application: Stream connection lost: IndexError('pop from an empty deque')", grpc_status:2, created_time:"2024-06-18T20:12:40.624492156+08:00"}"
</code>
Traceback (most recent call last):
File "/home/jason/anaconda3/envs/chatroom/lib/python3.9/tkinter/__init__.py", line 1892, in __call__
return self.func(*args)
File "/home/jason/codes/TalkyWalky/login_rpc.py", line 24, in Login
result = self.clientrpc.login()
File "/home/jason/codes/TalkyWalky/client.py", line 28, in login
res = self.stub.myLogin(helloworld_pb2.LoginRequest(username=self.username, password=self.password, queuename=self.queue_name)).res
File "/home/jason/anaconda3/envs/chatroom/lib/python3.9/site-packages/grpc/_channel.py", line 1181, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/home/jason/anaconda3/envs/chatroom/lib/python3.9/site-packages/grpc/_channel.py", line 1006, in _end_unary_response_blocking
raise _InactiveRpcError(state) # pytype: disable=not-instantiable
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "Exception calling application: Stream connection lost: IndexError('pop from an empty deque')"
debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"Exception calling application: Stream connection lost: IndexError('pop from an empty deque')", grpc_status:2, created_time:"2024-06-18T20:12:40.624492156+08:00"}"
And here is the traceback of my server:
<code>Exception has occurred: StreamLostError
Stream connection lost: IndexError('pop from an empty deque')
File "/home/jason/codes/TalkyWalky/server_rpc.py", line 135, in receive
self.channel.start_consuming()
File "/home/jason/codes/TalkyWalky/server_rpc.py", line 119, in connect
self.receive()
pika.exceptions.StreamLostError: Stream connection lost: IndexError('pop from an empty deque')
</code>
<code>Exception has occurred: StreamLostError
Stream connection lost: IndexError('pop from an empty deque')
File "/home/jason/codes/TalkyWalky/server_rpc.py", line 135, in receive
self.channel.start_consuming()
File "/home/jason/codes/TalkyWalky/server_rpc.py", line 119, in connect
self.receive()
pika.exceptions.StreamLostError: Stream connection lost: IndexError('pop from an empty deque')
</code>
Exception has occurred: StreamLostError
Stream connection lost: IndexError('pop from an empty deque')
File "/home/jason/codes/TalkyWalky/server_rpc.py", line 135, in receive
self.channel.start_consuming()
File "/home/jason/codes/TalkyWalky/server_rpc.py", line 119, in connect
self.receive()
pika.exceptions.StreamLostError: Stream connection lost: IndexError('pop from an empty deque')
And here is rabbitmq Server log:
<code>2024-06-18 20:34:12.135411+08:00 [info] <0.28361.0> accepting AMQP connection <0.28361.0> (127.0.0.1:44138 -> 127.0.0.1:5672)
2024-06-18 20:34:12.136909+08:00 [info] <0.28361.0> connection <0.28361.0> (127.0.0.1:44138 -> 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/'
2024-06-18 20:34:20.090332+08:00 [info] <0.28372.0> accepting AMQP connection <0.28372.0> (127.0.0.1:58042 -> 127.0.0.1:5672)
2024-06-18 20:34:20.091169+08:00 [info] <0.28372.0> connection <0.28372.0> (127.0.0.1:58042 -> 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/'
2024-06-18 20:34:20.096125+08:00 [warning] <0.28361.0> closing AMQP connection <0.28361.0> (127.0.0.1:44138 -> 127.0.0.1:5672, vhost: '/', user: 'guest'):
2024-06-18 20:34:20.096125+08:00 [warning] <0.28361.0> client unexpectedly closed TCP connection
</code>
<code>2024-06-18 20:34:12.135411+08:00 [info] <0.28361.0> accepting AMQP connection <0.28361.0> (127.0.0.1:44138 -> 127.0.0.1:5672)
2024-06-18 20:34:12.136909+08:00 [info] <0.28361.0> connection <0.28361.0> (127.0.0.1:44138 -> 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/'
2024-06-18 20:34:20.090332+08:00 [info] <0.28372.0> accepting AMQP connection <0.28372.0> (127.0.0.1:58042 -> 127.0.0.1:5672)
2024-06-18 20:34:20.091169+08:00 [info] <0.28372.0> connection <0.28372.0> (127.0.0.1:58042 -> 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/'
2024-06-18 20:34:20.096125+08:00 [warning] <0.28361.0> closing AMQP connection <0.28361.0> (127.0.0.1:44138 -> 127.0.0.1:5672, vhost: '/', user: 'guest'):
2024-06-18 20:34:20.096125+08:00 [warning] <0.28361.0> client unexpectedly closed TCP connection
</code>
2024-06-18 20:34:12.135411+08:00 [info] <0.28361.0> accepting AMQP connection <0.28361.0> (127.0.0.1:44138 -> 127.0.0.1:5672)
2024-06-18 20:34:12.136909+08:00 [info] <0.28361.0> connection <0.28361.0> (127.0.0.1:44138 -> 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/'
2024-06-18 20:34:20.090332+08:00 [info] <0.28372.0> accepting AMQP connection <0.28372.0> (127.0.0.1:58042 -> 127.0.0.1:5672)
2024-06-18 20:34:20.091169+08:00 [info] <0.28372.0> connection <0.28372.0> (127.0.0.1:58042 -> 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/'
2024-06-18 20:34:20.096125+08:00 [warning] <0.28361.0> closing AMQP connection <0.28361.0> (127.0.0.1:44138 -> 127.0.0.1:5672, vhost: '/', user: 'guest'):
2024-06-18 20:34:20.096125+08:00 [warning] <0.28361.0> client unexpectedly closed TCP connection
I do confirm, rabbitmq and grpc use different ports
I have no idea what i could try.