From 0f476adada1ebffb4f66d14b16d3371e68bf3ded Mon Sep 17 00:00:00 2001 From: Piotr Marcinkiewicz Date: Mon, 5 Feb 2024 18:40:15 +0100 Subject: [PATCH] Prevent double close in HTTP client __del__ --- src/python/library/tritonclient/http/_client.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/python/library/tritonclient/http/_client.py b/src/python/library/tritonclient/http/_client.py index 5608b56b7..1b71d82a7 100755 --- a/src/python/library/tritonclient/http/_client.py +++ b/src/python/library/tritonclient/http/_client.py @@ -190,6 +190,7 @@ def __init__( ) self._pool = gevent.pool.Pool(max_greenlets) self._verbose = verbose + self._closed = False def __enter__(self): return self @@ -205,8 +206,10 @@ def close(self): will result in an Error. """ - self._pool.join() - self._client_stub.close() + if not self._closed: + self._pool.join() + self._client_stub.close() + self._closed = True def _get(self, request_uri, headers, query_params): """Issues the GET request to the server