diff --git a/awsiot/eventstreamrpc.py b/awsiot/eventstreamrpc.py index 7ba8bd2a..d7992f7e 100644 --- a/awsiot/eventstreamrpc.py +++ b/awsiot/eventstreamrpc.py @@ -611,8 +611,8 @@ def __init__(self, stream_handler: StreamResponseHandler, shape_index: ShapeInde self._closed_future.set_running_or_notify_cancel() # prevent cancel self._initial_response_future = Future() self._initial_response_future.set_running_or_notify_cancel() # prevent cancel - self._protocol_handler = _ProtocolContinuationHandler(self) - self._continuation = connection._new_stream(self._protocol_handler) + protocol_handler = _ProtocolContinuationHandler(self) + self._continuation = connection._new_stream(protocol_handler) def _activate(self, request: Shape) -> Future: headers = [Header.from_string(CONTENT_TYPE_HEADER, @@ -805,6 +805,9 @@ def on_continuation_message(self, *args, **kwargs): def on_continuation_closed(self, *args, **kwargs): self.operation._on_continuation_closed(*args, **kwargs) + # break circular reference between: ClientOperation, _ProtocolContinuationHandler, ClientContinuation + # so that garbage collector can clean them up + self.operation = None class Client: diff --git a/setup.py b/setup.py index 41cd4c82..f35462f9 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ "Operating System :: OS Independent", ], install_requires=[ - 'awscrt==0.11.8', + 'awscrt==0.11.12', ], python_requires='>=3.5', )