Description
What happened
The Client.close() method only closes the mirror node gRPC channel, but does not close the consensus node channels stored in client.network.nodes.
Each _Node maintains a persistent gRPC channel (_channel) which remains open even after calling client.close() or using the client as a context manager (with Client(...)).
This leads to resource leaks and lingering open connections.
Expected behavior
All gRPC channels (including consensus node channels) should be properly closed when client.close() is called.
Fix
Added logic in Client.close() to iterate over self.network.nodes and close each node’s _channel.
This ensures all gRPC connections are properly cleaned up.
Steps to reproduce
- Create a Client instance
- Use it with a context manager:
with Client(...) as client:
pass
Additional context
📌 Additional context
Fix implemented by closing all `_Node._channel` instances inside `Client.close()`.
This aligns the behavior with expected resource management and prevents connection leaks.
### Hedera network
_No response_
### Version
v0.2.5
### Operating system
Windows
Description
What happened
The
Client.close()method only closes the mirror node gRPC channel, but does not close the consensus node channels stored inclient.network.nodes.Each
_Nodemaintains a persistent gRPC channel (_channel) which remains open even after callingclient.close()or using the client as a context manager (with Client(...)).This leads to resource leaks and lingering open connections.
Expected behavior
All gRPC channels (including consensus node channels) should be properly closed when
client.close()is called.Fix
Added logic in
Client.close()to iterate overself.network.nodesand close each node’s_channel.This ensures all gRPC connections are properly cleaned up.
Steps to reproduce
Additional context
📌 Additional context