Skip to content

Commit cfa42d2

Browse files
authored
grpc thread is not released each time connections.connect() is failed (#2648)
#2646 Signed-off-by: yhmo <[email protected]>
1 parent 5edb054 commit cfa42d2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pymilvus/client/grpc_handler.py

+3
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,19 @@ def _wait_for_channel_ready(self, timeout: Union[float] = 10):
150150
grpc.channel_ready_future(self._channel).result(timeout=timeout)
151151
self._setup_identifier_interceptor(self._user, timeout=timeout)
152152
except grpc.FutureTimeoutError as e:
153+
self.close()
153154
raise MilvusException(
154155
code=Status.CONNECT_FAILED,
155156
message=f"Fail connecting to server on {self._address}, illegal connection params or server unavailable",
156157
) from e
157158
except Exception as e:
159+
self.close()
158160
raise e from e
159161

160162
def close(self):
161163
self.deregister_state_change_callbacks()
162164
self._channel.close()
165+
self._channel = None
163166

164167
def reset_db_name(self, db_name: str):
165168
self.schema_cache.clear()

0 commit comments

Comments
 (0)