I tried to simulate a memory leak with occur in our environment by using the
following program.
public static void main(String[] args) {
try {
Properties properties = new Properties();
properties.put("connectionfactory.qpidConnectionfactory",
"amqp://admin:admin@clientID
/test?brokerlist='tcp://localhost:5672'");
properties.put("queue.queueName", "myQueue");
properties.put("java.naming.factory.initial",
"org.apache.qpid.jndi.PropertiesFileInitialContextFactory");
final Context context = new InitialContext(properties);
Runnable messageReceiver = new Runnable() {
public void run() {
while (true) {
try {
ConnectionFactory connectionFactory =
(ConnectionFactory) context.lookup("qpidConnectionfactory");
Connection connection =
connectionFactory.createConnection();
connection.start();
Session session =
connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination destination = (Destination)
context.lookup("queueName");
MessageConsumer messageConsumer =
session.createConsumer(destination);
TextMessage textMessage = (TextMessage)
messageConsumer.receive();
System.out.println(textMessage.getText());
messageConsumer.close();
session.close();
connection.stop();
connection.close();
} catch (JMSException e) {
e.printStackTrace();
} catch (NamingException e) {
e.printStackTrace();
}
}
}
};
Thread messageReceiveThread = new Thread(messageReceiver);
messageReceiveThread.start();
// let consumer to start first.
Thread.sleep(2000);
for (int i = 0; i < 10000; i++) {
ConnectionFactory connectionFactory = (ConnectionFactory)
context.lookup("qpidConnectionfactory");
Connection connection =
connectionFactory.createConnection();
connection.start();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Destination destination = (Destination)
context.lookup("queueName");
MessageProducer messageProducer =
session.createProducer(destination);
TextMessage message = session.createTextMessage("Hello world
message to test the qpid " + i);
messageProducer.send(message);
messageProducer.close();
session.close();
connection.stop();
connection.close();
Thread.sleep(50);
}
} catch (Exception exp) {
exp.printStackTrace();
}
}
After running this for about 7000 messages, Qpid server goes out of memory.
Please see the attachments.
I think this is a problem with connection removing when creating a lot of
connections.
thanks,
Amila.
On Sat, Mar 19, 2011 at 12:25 PM, Amila Suriarachchi <
[email protected]> wrote:
> I tried to create a durable queue like this
>
> queue = queueSession.createQueue("myQueue;{create:always, node:{durable:
> True}}");
> QueueSender queueSender = queueSession.createSender(queue);
> queueSender.send(textMessage);
>
> and getting this exception.
>
> Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast
> to java.lang.String
> at
> org.apache.qpid.client.messaging.address.AddressHelper.getDurability(AddressHelper.java:237)
> at
> org.apache.qpid.client.messaging.address.AddressHelper.fillInCommonNodeArgs(AddressHelper.java:222)
> at
> org.apache.qpid.client.messaging.address.AddressHelper.createQueueNode(AddressHelper.java:215)
> at
> org.apache.qpid.client.messaging.address.AddressHelper.getSourceNode(AddressHelper.java:254)
> at
> org.apache.qpid.client.AMQDestination.rebuildTargetAndSourceNodes(AMQDestination.java:888)
> at
> org.apache.qpid.client.AMQSession_0_10.resolveAddressType(AMQSession_0_10.java:1272)
>
> thanks,
> Amila.
>
>
> On Fri, Mar 18, 2011 at 9:26 PM, Justin Ross <[email protected]> wrote:
>
>> On Fri, 18 Mar 2011, Robert Godfrey wrote:
>>
>> I know Gordon said:
>>>
>>>
>>> "Specifically I'd suggest that unless anyone has specific updates to the
>>> following artefacts - and volunteers to verify the artefact for the
>>> release
>>> - we remove them from the published list:
>>>
>>> qpid-dotnet-0-8-0.10-beta.zip
>>> qpid-dotnet-0-10-0.10-beta.
>>> zip
>>> qpid-ruby-0.10-beta.tar.gz
>>>
>>> This will avoid giving false impressions about ongoing maintenance for
>>> these
>>> clients"
>>>
>>> But I think that if we are going to actually do this, we should formally
>>> vote for it, and move the codebases for these artefacts into an "attic"
>>> directory or similar.
>>>
>>> I'm not against removing unloved and unmaintained code... but I do feel
>>> that
>>> we should vote before adding or removing artefacts to/from the release.
>>>
>>
>> Okay. I'll restore these to RC2 unless there's a vote to remove them.
>>
>> Justin
>>
>>
>> ---------------------------------------------------------------------
>> Apache Qpid - AMQP Messaging Implementation
>> Project: http://qpid.apache.org
>> Use/Interact: mailto:[email protected]
>>
>>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>
--
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]