Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIXED] Memory growth from NRG create and delete operations #5600

Merged
merged 4 commits into from
Jun 27, 2024

Conversation

derekcollison
Copy link
Member

Fix for situations where GC struggled to clean up things.

This mostly stemmed from subscriptions being held in per connection caches (routers and gateways). These held references to both clients and any internal callbacks, which usually were closures so would also hold reference to the struct target as well.

Signed-off-by: Derek Collison derek@nats.io

Signed-off-by: Derek Collison <derek@nats.io>
…egistering

Signed-off-by: Derek Collison <derek@nats.io>
Signed-off-by: Derek Collison <derek@nats.io>
This mostly stemmed from subscriptions being held in per connection caches (routers and gateways). These held references to both clients and any icb, which usually were closures so would also hold reference to the struct target as well.
The code was not working correctly as it would only delete the subject in question, but when generation id changes we need to blow the whole cache similar to normal clients.

Signed-off-by: Derek Collison <derek@nats.io>
@derekcollison derekcollison requested a review from a team as a code owner June 27, 2024 02:04
Copy link
Member

@wallyqs wallyqs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@derekcollison derekcollison merged commit 1761eac into main Jun 27, 2024
3 checks passed
@derekcollison derekcollison deleted the sub-ref-leaks-3 branch June 27, 2024 02:20
wallyqs pushed a commit that referenced this pull request Jun 27, 2024
Fix for situations where GC struggled to clean up things.

This mostly stemmed from subscriptions being held in per connection
caches (routers and gateways). These held references to both clients and
any internal callbacks, which usually were closures so would also hold
reference to the struct target as well.
 
Signed-off-by: Derek Collison <derek@nats.io>

---------

Signed-off-by: Derek Collison <derek@nats.io>
wallyqs added a commit that referenced this pull request Jun 27, 2024
Includes:

* #5593
* #5597
* #5600

Signed-off-by: Neil Twigg <neil@nats.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants