Skip to content

Commit

Permalink
Fix leak of ModelClient inside _LogLevelChecker in Triton
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrm-nvidia committed Nov 13, 2023
1 parent 25a8845 commit c624fcd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pytriton/triton.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ def __init__(self, url: str) -> None:
Raises:
PyTritonClientInvalidUrlError: if url is invalid
"""
self._client = ModelClient(url, "Dummy")
self._log_settings = None
self._url = url

def check(self, skip_update: bool = False):
"""Check if log level is too verbose.
Expand All @@ -301,8 +301,9 @@ def check(self, skip_update: bool = False):
PyTritonClientTimeoutError: if timeout is reached
"""
if self._log_settings is None and not skip_update:
wait_for_server_ready(self._client._general_client, timeout_s=DEFAULT_TRITON_STARTUP_TIMEOUT_S)
self._log_settings = self._client._general_client.get_log_settings()
with ModelClient(self._url, "Dummy") as client:
wait_for_server_ready(client._general_client, timeout_s=DEFAULT_TRITON_STARTUP_TIMEOUT_S)
self._log_settings = client._general_client.get_log_settings()

if self._log_settings is not None:
log_settings = self._log_settings
Expand Down

0 comments on commit c624fcd

Please sign in to comment.