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 » QMGR Object and garbage collection

Post new topic  Reply to topic
 QMGR Object and garbage collection « View previous topic :: View next topic » 
Author Message
RNStanich
PostPosted: Tue Jun 01, 2010 6:58 am    Post subject: QMGR Object and garbage collection Reply with quote

Acolyte

Joined: 23 Apr 2002
Posts: 64

Hi all, I'm more an admin guy than a developer so I'm searching to see if this issue has crossed anyone's path. This email was sent by the developer.

I just wanted to give you a breakdown of the potential bug that we found with the com.ibm.mq.MQQueueManager class. As I showed you yesterday, it appears that the com.ibm.mq.MQQueueManager objects are not eligible for garbage collection for some reason or another. The simple test that I preformed yesterday creates a connection to a queue manager and then immediately disconnects and is set to null. However, as we saw in the jLeak monitor, the MQQueueManager objects remained even after several forced garbage collections. I have tried this with 2 version of the jar; 6.0.2.9 and 7.0.1.2.

Here is the code…

MQQueueManager qMgr = null;
MQQueue replyQueue = null;
MQQueue requestQueue = null;
MQEnvironment.hostname = "HOMQADC01";
MQEnvironment.port = 1414;
MQEnvironment.channel = "CLIENT.ADCD";
try{
qMgr = new MQQueueManager("ADCD");
}
catch(MQException e){
e.printStackTrace();
}
qMgr.disconnect();
qMgr = null;


Any thoughts or direction for the development team would be appreciated.
_________________
Regards, Bob
Back to top
View user's profile Send private message
RNStanich
PostPosted: Tue Jun 01, 2010 7:17 am    Post subject: Reply with quote

Acolyte

Joined: 23 Apr 2002
Posts: 64

Me again, just a couple of additional points. In some recent reading I'm seeing that forcing garbage collection is not a guarrentee. That's fine - the issue was being tested because of continued memory usasge; the current workaround is to cycle the JVM every day.

Also this issue started occuring when we went from using Websphere Application Server to using Tomcat. Perhaps WAS played better with WMQ.

So before opening a pmr with IBM I thought I'd toss this out here to see if it's a known issue that I cannot find any reference to...Thanks
_________________
Regards, Bob
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Tue Jun 01, 2010 8:17 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

RNStanich wrote:
it appears that the com.ibm.mq.MQQueueManager objects are not eligible for garbage collection for some reason or another.

RNStanich wrote:
Also this issue started occuring when we went from using Websphere Application Server to using Tomcat.

Java garbage collection is not based on the J2EE container but rather the version of the JVM. Maybe you need to update the version of the JVM you are using with Tomcat.

RNStanich wrote:
Code:
MQQueueManager qMgr = null;
MQQueue replyQueue = null;
MQQueue requestQueue = null;
MQEnvironment.hostname = "HOMQADC01";
MQEnvironment.port = 1414;
MQEnvironment.channel = "CLIENT.ADCD";
try{
qMgr = new MQQueueManager("ADCD");
}
catch(MQException e){
      e.printStackTrace();
}
qMgr.disconnect();
qMgr = null;

Not to be picky but since you are running your code in a J2EE container, why are you using "MQ based Java" instead of JMS?

Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Tue Jun 01, 2010 8:20 am    Post subject: Reply with quote

Grand High Poobah

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

OK, as you're using Tomcat I'd ditch the MQbase stuff and use JMS.
Now for the good stuff you need to specify version of MQ.
There is one that needs an APAR to release and gc the connection factory.

_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
RNStanich
PostPosted: Tue Jun 01, 2010 9:50 am    Post subject: Reply with quote

Acolyte

Joined: 23 Apr 2002
Posts: 64

Thank you both for the quick responses...some additional info...

I guess we did experience the same issues with WAS but it was able to recover more gracefully (no details on what that means - sorry) so it was less of an issue to our Client/Server folks.

Roger, we are in the process of building JMS based applications; these just haven't switched over yet. Also we're running on Java 1.6.0_20 so that seems fairly current.

fjb - the qmgr is at version 6.0.2.4. The client apps are at v6.0.2.2 or 2.4 and as noted in my original post the client was tested using the jar file from v6.0.2.9 and v7.0.1.2. Do you have a number for the APAR you noted? Was it version dependent?
_________________
Regards, Bob
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jun 01, 2010 12:37 pm    Post subject: Reply with quote

Grand High Poobah

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

If you still experience it at 6.0.2.9 or 7.0.1.2 open a PMR.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
JLRowe
PostPosted: Wed Jun 02, 2010 3:10 am    Post subject: Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

Post the full code as your example does not do anything. Perhaps you are leaking a reference to the queue and this is keeping a reference to the QM?

You need to surround all shutdown operations with a try/catch, and log any swallowed exceptions to help with problem diagnosis.

e.g.

try {
qm.disconnect();
} catch (Exception e) {
logger.log("Exception ignored during qm.disconnect()", e);
}
qm = null;

If you start to use JMS, then checkout the spring framework, the JMSTemplate class makes JMS operations a breeze, it handles all the shutdown issues for you.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » QMGR Object and garbage collection
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.