You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Memory leaks when an IPC subscription is created and closed.
Heap dumps from affected machines show that the memory is hogged by the object Map<String, SubscriptionTrie<K>> children in an instance of the class SubscriptionTrie (see source). The SubscriptionTrie instance that hogs the memory is called listeners which is a member of the class PubSubIPCEventStreamAgent (source).
In PubSubIPCEventStreamAgent.handleUnsubscribeToTopicRequest() (which I believe is invoked when calling close() on SubscribeToTopicOperationin the Python SDK, which we're using in our application), a call to remove() on listeners is made. When inspecting the source for remove(), it seems that the member subscriptionCallbacks is cleaned up, but not children. subscriptionCallbacks and children are the only non-static final members of SubscriptionTrie. To Reproduce
Using the Python SDK:
OpenJDK 64-Bit Server VM (build 11.0.25+9-post-Ubuntu-1ubuntu122.04, mixed mode, sharing)
Nucleus version: 2.11.2
Additional context
A related issue was opened a few months ago (#1650), but closed due to the belief that this is a problem in the Python SDK (and also due to incorrect usage of GreengrassCoreIPCClientV2 in the example, which is fixed in the example in this issue).
An issue was therefore opened in the Python SDK repo: aws/aws-iot-device-sdk-python-v2#589
But given the above reasoning, I don't think it is within the power of the Python SDK to clean up the subscription-related data in SubscriptionTrie.children, as it does not seem like remove() (or any other method) removes data from the children member upon unsubscription - therefore I opened this issue.
This bug impacts us because our application creates new subscriptions regularly. The devices we build are intended to run for months or years, but often they run out of memory and require manual intervention after a few weeks.
The text was updated successfully, but these errors were encountered:
Describe the bug
Memory leaks when an IPC subscription is created and closed.
Heap dumps from affected machines show that the memory is hogged by the object
Map<String, SubscriptionTrie<K>> children
in an instance of the classSubscriptionTrie
(see source). TheSubscriptionTrie
instance that hogs the memory is calledlisteners
which is a member of the classPubSubIPCEventStreamAgent
(source).In
PubSubIPCEventStreamAgent.handleUnsubscribeToTopicRequest()
(which I believe is invoked when callingclose()
onSubscribeToTopicOperation
in the Python SDK, which we're using in our application), a call toremove()
onlisteners
is made. When inspecting the source forremove()
, it seems that the membersubscriptionCallbacks
is cleaned up, but notchildren
.subscriptionCallbacks
andchildren
are the only non-static final
members ofSubscriptionTrie
.To Reproduce
Using the Python SDK:
The above example seemingly causes unbounded heap usage growth.
Expected behavior
The memory allocated when setting up a subscription should be completely freed when calling
subscribe_to_topic_operation.close()
.Actual behavior
The memory allocated when setting up a subscription is not completely freed despite calling
subscribe_to_topic_operation.close()
.Environment
Additional context
A related issue was opened a few months ago (#1650), but closed due to the belief that this is a problem in the Python SDK (and also due to incorrect usage of
GreengrassCoreIPCClientV2
in the example, which is fixed in the example in this issue).An issue was therefore opened in the Python SDK repo: aws/aws-iot-device-sdk-python-v2#589
But given the above reasoning, I don't think it is within the power of the Python SDK to clean up the subscription-related data in
SubscriptionTrie.children
, as it does not seem likeremove()
(or any other method) removes data from thechildren
member upon unsubscription - therefore I opened this issue.This bug impacts us because our application creates new subscriptions regularly. The devices we build are intended to run for months or years, but often they run out of memory and require manual intervention after a few weeks.
The text was updated successfully, but these errors were encountered: