eWaterCycle / eWaterCycle/grpc4bmi
Unable to connect to GRPC server
- Dominant language
- Python
- Stars
- 5
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
I am unable to connect to the GRPC server, even when starting the GRPC server inside the same python instance.
Setup:
- WSL2, Ubuntu 20.04
- Python 3.8.10
- grpc4bmi 0.2.x (latest)
The code I use to start the server, and connect to the model:
```py
>>> import grpc
>>> from grpc4bmi.bmi_client_subproc import BmiClientSubProcess
>>> model = BmiClientSubProcess("pywflow.wflow.WflowBMI")
Starting GRPC server for at port 46137
>>> import grpc
>>> from grpc4bmi.bmi_grpc_client import BmiClient
>>> mymodel = BmiClient(grpc.insecure_channel("localhost:46137"))
```
Upon calling `get_model_name`, an error occurs. `AttributeError: 'BmiClientSubProcess' object has no attribute 'pipe'`.
It does not matter if I connect to the server in the same python instance, or in a different one (running concurrently).
```
>>> mymodel.get_component_name()
Exception ignored in:
Traceback (most recent call last):
File "/home/bart/grpc4bmi-0.2.x/grpc4bmi/bmi_client_subproc.py", line 29, in __del__
self.pipe.terminate()
AttributeError: 'BmiClientSubProcess' object has no attribute 'pipe'
Traceback (most recent call last):
File "", line 1, in
File "/home/bart/grpc4bmi-0.2.x/grpc4bmi/bmi_grpc_client.py", line 77, in get_component_name
return str(self.stub.getComponentName(bmi_pb2.Empty()).name)
File "/home/bart/venv/grpc/lib/python3.8/site-packages/grpc/_channel.py", line 946, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/home/bart/venv/grpc/lib/python3.8/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "Socket closed"
debug_error_string = "UNKNOWN:Error received from peer ipv6:%5B::1%5D:46137 {created_time:"2022-11-14T09:09:04.782000456+01:00", grpc_status:14, grpc_message:"Socket closed"}"
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the supplied WSL2 example, then inspect grpc4bmi/bmi_client_subproc.py around line 29 and grpc4bmi/bmi_grpc_client.py around line 77. Trace why the server connection closes during get_component_name and why cleanup reports a missing pipe. Done means the example completes without the unavailable RPC error or the destructor AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100