You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Yuta Kawadai <yu...@gmail.com> on 2010/05/25 05:20:44 UTC

Is C++ broker memory leak?

Hi,

The more I run Java test code which is simply declare/delete queue and
check the queue existence by queuequery(please see below), the more
C++ broker memory size increase(NEVER decrease).
Every times, the test code is successful.

Here is run summary(the test code run 10 times.).

           |   broker memory size
Run #  |   (MB)
----------|------------------------------
initial   |    3
#1       |   23
#2       |   42
#3       |   50
#4       |   52
#5       |   65
#6       |   64
#7       |   72
#8       |   77
#9       |   81
#10     |   88


My question is,
Although the queue had been deleted, why broker memory didn't decrease?
Is broker memory leak?
Or Is there mistake about how to use Java client API?

Regards,
Yuta


Details:
qpid 0.6
C++ Broker(windows, x64)(downloaded from
http://www.riverace.com/qpid/downloads.htm)
Java client
OS:Win XP x64 SP2
CPU:Core2 Duo E6750
Mem:8GB
JRE:Sun1.6.0_12(x64)


--------------------------test code start----------------------------------
import static org.testng.Assert.*;

import java.util.UUID;

import org.apache.qpid.transport.Connection;
import org.apache.qpid.transport.Future;
import org.apache.qpid.transport.Option;
import org.apache.qpid.transport.QueueQueryResult;
import org.apache.qpid.transport.Session;
import org.testng.annotations.Test;

public class QPIDSpecTest
{
    private final String HOST_NAME = "localhost";
    private final int PORT_NO = 5672;
    private final String VIRTUAL_HOST = "test";
    private final String USER_NAME = "qpid";
    private final String PASSWORD = "qpid";

    @Test
    public void testDeclareQueue()
    {
        Connection connection = new Connection();
        connection.connect(HOST_NAME, PORT_NO, VIRTUAL_HOST,
USER_NAME, PASSWORD);
        Session session = connection.createSession();

        final int REPEAT_NUM = 10000;
        for(int i = 0; i < REPEAT_NUM; i++)
        {
            UUID uuid = UUID.randomUUID();
            String name = uuid.toString();
            session.queueDeclare(name, null, null, Option.EXCLUSIVE,
Option.AUTO_DELETE);
            session.sync();

            Future<QueueQueryResult> resultFuture = session.queueQuery(name);
            QueueQueryResult result = resultFuture.get();
            assertTrue(result.hasQueue());

            session.queueDelete(name);
            session.sync();

            Future<QueueQueryResult> resultAfterFuture =
session.queueQuery(name);
            QueueQueryResult resultAfter = resultAfterFuture.get();
            assertFalse(resultAfter.hasQueue());
        }

        session.close();
        connection.close();
    }
}

--------------------------test code end----------------------------------

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Is C++ broker memory leak?

Posted by Gordon Sim <gs...@redhat.com>.
On 05/27/2010 03:12 PM, Yuta Kawadai wrote:
>>> My question is,
>>> Although the queue had been deleted, why broker memory didn't decrease?
>>
>> Memory will not be released back to the OS every time a block is freed, so I
>> wouldn't necessarily expect an immediate, direct change in memory just from
>> deleting a queue.
> I see. But if so, the broker should be restart periodically, right?

No, the allocator will eventually give memory back; it will also reuse it.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Is C++ broker memory leak?

Posted by Yuta Kawadai <yu...@gmail.com>.
Thanks reply.

> Thank you for the report - could you please record this problem in JIRA
> (http://issues.apache.org/jira/browse/qpid) to ensure it is investigated
> and tracked correctly?
OK, I've opened a JIRA issue:

https://issues.apache.org/jira/browse/QPID-2630


>> My question is,
>> Although the queue had been deleted, why broker memory didn't decrease?
>
> Memory will not be released back to the OS every time a block is freed, so I
> wouldn't necessarily expect an immediate, direct change in memory just from
> deleting a queue.
I see. But if so, the broker should be restart periodically, right?


>> Is broker memory leak?
>
> In the 'run' column above, does a run represent one iteration through the
> loop in the test, or a run through the whole test (i.e. each run includes
> 10000 iterations)?
Sorry.
A 'run' represent one iteration through the whole test.
So, in that case, a run declare/delete queue 10,000 times each time
and 100,000 times in all.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Is C++ broker memory leak?

Posted by Gordon Sim <gs...@redhat.com>.
On 05/25/2010 04:20 AM, Yuta Kawadai wrote:
> Hi,
>
> The more I run Java test code which is simply declare/delete queue and
> check the queue existence by queuequery(please see below), the more
> C++ broker memory size increase(NEVER decrease).
> Every times, the test code is successful.
>
> Here is run summary(the test code run 10 times.).
>
>             |   broker memory size
> Run #  |   (MB)
> ----------|------------------------------
> initial   |    3
> #1       |   23
> #2       |   42
> #3       |   50
> #4       |   52
> #5       |   65
> #6       |   64
> #7       |   72
> #8       |   77
> #9       |   81
> #10     |   88
>
>
> My question is,
> Although the queue had been deleted, why broker memory didn't decrease?

Memory will not be released back to the OS every time a block is freed, 
so I wouldn't necessarily expect an immediate, direct change in memory 
just from deleting a queue.

> Is broker memory leak?

In the 'run' column above, does a run represent one iteration through 
the loop in the test, or a run through the whole test (i.e. each run 
includes 10000 iterations)?

> Or Is there mistake about how to use Java client API?

I certainly don't see any mistake in your example (I would note however 
that the recommended API is JMS).

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


RE: Is C++ broker memory leak?

Posted by Steve Huston <sh...@riverace.com>.
Hi Yuta,

Thank you for the report - could you please record this problem in JIRA
(http://issues.apache.org/jira/browse/qpid) to ensure it is investigated
and tracked correctly?

Thank you,
-Steve

--
Steve Huston, Riverace Corporation
Total Lifecycle Support for Your Networked Applications
http://www.riverace.com


> -----Original Message-----
> From: Yuta Kawadai [mailto:yutax77@gmail.com] 
> Sent: Monday, May 24, 2010 11:21 PM
> To: users@qpid.apache.org
> Subject: Is C++ broker memory leak?
> 
> 
> Hi,
> 
> The more I run Java test code which is simply declare/delete 
> queue and check the queue existence by queuequery(please see 
> below), the more
> C++ broker memory size increase(NEVER decrease).
> Every times, the test code is successful.
> 
> Here is run summary(the test code run 10 times.).
> 
>            |   broker memory size
> Run #  |   (MB)
> ----------|------------------------------
> initial   |    3
> #1       |   23
> #2       |   42
> #3       |   50
> #4       |   52
> #5       |   65
> #6       |   64
> #7       |   72
> #8       |   77
> #9       |   81
> #10     |   88
> 
> 
> My question is,
> Although the queue had been deleted, why broker memory didn't 
> decrease? Is broker memory leak? Or Is there mistake about 
> how to use Java client API?
> 
> Regards,
> Yuta
> 
> 
> Details:
> qpid 0.6
> C++ Broker(windows, x64)(downloaded from
> http://www.riverace.com/qpid/downloads.htm)
> Java client
> OS:Win XP x64 SP2
> CPU:Core2 Duo E6750
> Mem:8GB
> JRE:Sun1.6.0_12(x64)
> 
> 
> --------------------------test code 
> start----------------------------------
> import static org.testng.Assert.*;
> 
> import java.util.UUID;
> 
> import org.apache.qpid.transport.Connection;
> import org.apache.qpid.transport.Future;
> import org.apache.qpid.transport.Option;
> import org.apache.qpid.transport.QueueQueryResult;
> import org.apache.qpid.transport.Session;
> import org.testng.annotations.Test;
> 
> public class QPIDSpecTest
> {
>     private final String HOST_NAME = "localhost";
>     private final int PORT_NO = 5672;
>     private final String VIRTUAL_HOST = "test";
>     private final String USER_NAME = "qpid";
>     private final String PASSWORD = "qpid";
> 
>     @Test
>     public void testDeclareQueue()
>     {
>         Connection connection = new Connection();
>         connection.connect(HOST_NAME, PORT_NO, VIRTUAL_HOST, 
> USER_NAME, PASSWORD);
>         Session session = connection.createSession();
> 
>         final int REPEAT_NUM = 10000;
>         for(int i = 0; i < REPEAT_NUM; i++)
>         {
>             UUID uuid = UUID.randomUUID();
>             String name = uuid.toString();
>             session.queueDeclare(name, null, null, 
> Option.EXCLUSIVE, Option.AUTO_DELETE);
>             session.sync();
> 
>             Future<QueueQueryResult> resultFuture = 
> session.queueQuery(name);
>             QueueQueryResult result = resultFuture.get();
>             assertTrue(result.hasQueue());
> 
>             session.queueDelete(name);
>             session.sync();
> 
>             Future<QueueQueryResult> resultAfterFuture = 
> session.queueQuery(name);
>             QueueQueryResult resultAfter = resultAfterFuture.get();
>             assertFalse(resultAfter.hasQueue());
>         }
> 
>         session.close();
>         connection.close();
>     }
> }
> 
> --------------------------test code 
> end----------------------------------
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
> 
> 


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org