You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Odyldzhon Toshbekov (JIRA)" <ji...@apache.org> on 2017/05/20 20:30:04 UTC

[jira] [Comment Edited] (ARTEMIS-1175) Memory Leak Mqtt

    [ https://issues.apache.org/jira/browse/ARTEMIS-1175?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16018609#comment-16018609 ] 

Odyldzhon Toshbekov edited comment on ARTEMIS-1175 at 5/20/17 8:29 PM:
-----------------------------------------------------------------------

Test case:
1. Start Artemis broker 2.1.0 with max heap 150m (150m heap to reduce time to reproduce OOM)
2. Connect to broker using MQTT Client and subscribe to topic with name "test"
3. Connect to broker using MQTT Client and send to topic with name "test" 1_000_000 messages
4. Wait until all messages will be delivered to subscriber from step 2.

Expected result : Artemis handles all messages and doesn't occupy all heap after all messages will be delivered.
Actual result: Artemis uses more and more memory what leads to OOM.

Flight recording of memory usage
!Screen Shot 2017-05-20 at 10.52.00 PM.png|width=100%, height=100%!

Heap dump
!Screen Shot 2017-05-20 at 11.05.49 PM.png|width=100%, height=100%!

The map which I mentioned in the description of the issue
!!! The size is equals to the number of sent messages (see issue description why)
!Screen Shot 2017-05-20 at 11.10.47 PM.png|width=100%, height=100%!

I have attached the configuration which I use for test [^broker.xml]
The code to simulate MQTT clients behavior located here https://github.com/Odyldzhon/artemis-oom-test 
The result of code execution : [^test_output.txt]

I hope it will help


was (Author: odyldzhon@gmail.com):
Test case:
1. Start Artemis broker 2.1.0 with max heap 150m (150m heap to increase time to reproduce OOM)
2. Connect to broker using MQTT Client and subscribe to topic with name "test"
3. Connect to broker using MQTT Client and send to topic with name "test" 1_000_000 messages
4. Wait until all messages will be delivered to subscriber from step 2.

Expected result : Artemis handles all messages and doesn't occupy all heap after all messages will be delivered.
Actual result: Artemis uses more and more memory what leads to OOM.

Flight recording of memory usage
!Screen Shot 2017-05-20 at 10.52.00 PM.png|width=100%, height=100%!

Heap dump
!Screen Shot 2017-05-20 at 11.05.49 PM.png|width=100%, height=100%!

The map which I mentioned in the description of the issue
!!! The size is equals to the number of sent messages (see issue description why)
!Screen Shot 2017-05-20 at 11.10.47 PM.png|width=100%, height=100%!

I have attached the configuration which I use for test [^broker.xml]
The code to simulate MQTT clients behavior located here https://github.com/Odyldzhon/artemis-oom-test 
The result of code execution : [^test_output.txt]

I hope it will help

> Memory Leak Mqtt
> ----------------
>
>                 Key: ARTEMIS-1175
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1175
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: MQTT
>    Affects Versions: 1.5.3, 2.1.0
>            Reporter: Odyldzhon Toshbekov
>         Attachments: broker.xml, Screen Shot 2017-05-19 at 3.47.46 PM.png, Screen Shot 2017-05-20 at 10.52.00 PM.png, Screen Shot 2017-05-20 at 11.05.49 PM.png, Screen Shot 2017-05-20 at 11.10.47 PM.png, test_output.txt
>
>
> Artemis periodically crashed because of OOM. 
> I don't have ability to get heap dump from the server where OOM is happens but I reproduce memory leak on my machine (7 clients send 1message every 100 ms to the 1 subscriber)
> Looks like memory leak occurs in the class MQTTSessionState.OutboundStore because every time when Artemis publish message to subscriber he put to map "artemisToMqttMessageMap" key = (serverId + ":"+consumerId) and value = (mqttId) where serverId is id of message generated on Artemis side.
> This map is never are cleaned expect subscriber will be reconnected.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)