-
Notifications
You must be signed in to change notification settings - Fork 823
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
Fix reference's leak in fast publish of Qos0 and slow subscriber use case #649
Fix reference's leak in fast publish of Qos0 and slow subscriber use case #649
Conversation
As soon as a client disconnects, leaks are expected, since that is the reason issue #608 exists: queues are not cleaned up when sessions are destroyed. Edit: I was not patient enough, with only 1 publisher/subscriber it takes a while before garbage collection happens :) |
@@ -318,6 +318,7 @@ public void unsubscribe(List<String> topics, MQTTConnection mqttConnection, int | |||
} | |||
|
|||
interceptor.notifyTopicPublished(msg, clientID, username); | |||
// ? ReferenceCountUtil.release(msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the correct fix. A similar release happens for QoS 1 and 2 messages, but was missing for QoS 0.
Hi @hylkevds I missed to pushed the updated suite, now it has 2 tests:
|
…ors in an asynch way
Hi @hylkevds this PR fixes the leak, would be great if you can review it. |
Yep, looks good. Testing with really big messages may also speed up the exception, since it will cause Netty to reserve much more memory for those leaked buffers! The release in |
Release notes
Fix a message leak in handling PUB qos0 message.
What does this PR do?
Handling PUB message is a multistep process, it regards forwarding the payload/message to appropriate target sessions event queues and notify the registered interceptors.
When the front processing of the message is terminated, i has to free appropriately the message, decrementing the reference count. This PR fixes a missed decrement.
Why is it important/What is the impact to the user?
It fixes a bug that happens when a fast puglisher send QoS0 messagges to a slow subscriber.
How to test this PR locally
To prove run the only test method in
FastPublisherSlowSubscriberTest.asFastAsItCan
.