ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Dropping connection problem

Post new topic  Reply to topic
 Dropping connection problem « View previous topic :: View next topic » 
Author Message
amer.abugharbieh
PostPosted: Wed Nov 26, 2008 1:16 am    Post subject: Dropping connection problem Reply with quote

Newbie

Joined: 25 Nov 2008
Posts: 5

hey guys,
im trying to make a stress test to my application that send messages to Queue.
the problem is, when start lets say just 20 concurrent threads
some exception appears

here is the Code im using:

try {

MQQueueManager qMgr = null;
int openOptions = 8217;
MQEnvironment.hostname = "myIp";
MQEnvironment.channel = "myChannel";
MQEnvironment.port = 1414;

String man = "myManager";
qMgr = new MQQueueManager(man);
MQQueue resQueue = qMgr.accessQueue("queue.FrontendQueue"
, openOptions, null, null, null);

MQMessage putMessage = new MQMessage();
MQPutMessageOptions pmo = new MQPutMessageOptions();

putMessage.writeString("test message");
resQueue.put(putMessage, pmo);

resQueue.close();
qMgr.close();

}catch (Exception e) {
e.printStackTrace();
}




all the configuration are right, and i can send messages to the queue
but the problem when i start many threads this exception appears
BTW, there is property in the MQ "Max Handles" set to 265
im just trying 10 or 20 threads and its generate this exception:




com.ibm.mq.MQException: MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:212)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11._createManagedConnection(MQClientManagedConnectionFactoryJ11.java:318)
at com.ibm.mq.MQClientManagedConnectionFactoryJ11.createManagedConnection(MQClientManagedConnectionFactoryJ11.java:338)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:84)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:168)
at com.ibm.mq.MQQueueManagerFactory.obtainBaseMQQueueManager(MQQueueManagerFactory.java:772)
at com.ibm.mq.MQQueueManagerFactory.procure(MQQueueManagerFactory.java:697)
at com.ibm.mq.MQQueueManagerFactory.constructQueueManager(MQQueueManagerFactory.java:657)
at com.ibm.mq.MQQueueManagerFactory.createQueueManager(MQQueueManagerFactory.java:153)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:451)
at IBMMQQueueSenderImpl.send(IBMMQQueueSenderImpl.java:97)
at SendToIBMMQ.run(SendToIBMMQ.java:69)
at java.lang.Thread.run(Thread.java:568)
Caused by: com.ibm.mqservices.MQInternalException: MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009
at com.ibm.mq.MQv6InternalCommunications.checkControlFlags(MQv6InternalCommunications.java:740)
at com.ibm.mq.MQv6InternalCommunications.establishChannel(MQv6InternalCommunications.java:656)
at com.ibm.mq.MQv6InternalCommunications.initialize(MQv6InternalCommunications.java:206)
at com.ibm.mq.MQv6InternalCommunications.<init>(MQv6InternalCommunications.java:102)
at com.ibm.mq.MQSESSIONClient.MQCONNX(MQSESSIONClient.java:1337)
at com.ibm.mq.MQSESSIONClient.MQCONN(MQSESSIONClient.java:1246)
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:184)
... 12 more
MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009
MQJE001: An MQException occurred: Completion Code 2, Reason 2009
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 2009

anybody can help ?
Thank u guys in advance.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 26, 2008 2:33 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

I'm sure you've already determined that 2009 is a client connection being severed by the queue manager. Typically it's because the queue manager has run out of resource to support additional connections and is recycling old ones.

Take it as your platform failing the stress test. Look for something else loading the box heavily as a primary cause.

I'd be surprised if it was a code issue your end.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
amer.abugharbieh
PostPosted: Wed Nov 26, 2008 2:49 am    Post subject: Reply with quote

Newbie

Joined: 25 Nov 2008
Posts: 5

Thanks for your fast reply

according to the servers, the MQ installed on a server;
Quad core 2 GB HTz 6 MB cache
4 GB RAM
no other programs working on it, just the MQ.
is there any properties in the MQ maybe i need to consider, for example the Xms (heap size)?
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 26, 2008 2:59 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

amer.abugharbieh wrote:
is there any properties in the MQ maybe i need to consider, for example the Xms (heap size)?


I don't know. I'll leave it for those with better Java to comment on this, and also on any issues in your code I may have overlooked, like it not releasing connections perhaps. I mean it looks ok to me, but that doesn't prove all that much.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Nov 26, 2008 10:49 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Quote:
try {

MQQueueManager qMgr = null;
int openOptions = 8217;
MQEnvironment.hostname = "myIp";
MQEnvironment.channel = "myChannel";
MQEnvironment.port = 1414;

String man = "myManager";
qMgr = new MQQueueManager(man);
MQQueue resQueue = qMgr.accessQueue("queue.FrontendQueue"
, openOptions, null, null, null);

MQMessage putMessage = new MQMessage();
MQPutMessageOptions pmo = new MQPutMessageOptions();

putMessage.writeString("test message");
resQueue.put(putMessage, pmo);

resQueue.close();
qMgr.close();

}catch (Exception e) {
e.printStackTrace();
}


OK so your coding is mighty inefficient as you create a connection for each message.
You should have multiple methods on your class. Initialize it by opening the connection to the qmgr and the queue.

Use a different method to loop around the put. Then call different methods again to close the connections.

Note as well that your piece of code is not well behaved. In case of an exception being called you leave the connection open.

Closing the open connections should be part of a finally block.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
amer.abugharbieh
PostPosted: Wed Apr 22, 2009 2:43 am    Post subject: Reply with quote

Newbie

Joined: 25 Nov 2008
Posts: 5

this will solve the problem
i solve it long time ago, but i forgot to post it

mqMgr.disconnect(); // put it after mqMgr.close();
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Apr 22, 2009 2:49 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

amer.abugharbieh wrote:
this will solve the problem


Yes, and it will also cause others. As my most worthy associate has pointed out, you should not connect and disconnect for each message. It's hideously inefficient.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
amer.abugharbieh
PostPosted: Wed Apr 22, 2009 2:53 am    Post subject: Reply with quote

Newbie

Joined: 25 Nov 2008
Posts: 5

Vitor wrote:
amer.abugharbieh wrote:
this will solve the problem


Yes, and it will also cause others. As my most worthy associate has pointed out, you should not connect and disconnect for each message. It's hideously inefficient.


this is true
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Dropping connection problem
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.