Author |
Message
|
RNStanich |
Posted: Tue Jun 01, 2010 6:58 am Post subject: QMGR Object and garbage collection |
|
|
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 |
|
 |
RNStanich |
Posted: Tue Jun 01, 2010 7:17 am Post subject: |
|
|
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 |
|
 |
RogerLacroix |
Posted: Tue Jun 01, 2010 8:17 am Post subject: |
|
|
 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 |
|
 |
fjb_saper |
Posted: Tue Jun 01, 2010 8:20 am Post subject: |
|
|
 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 |
|
 |
RNStanich |
Posted: Tue Jun 01, 2010 9:50 am Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Tue Jun 01, 2010 12:37 pm Post subject: |
|
|
 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 |
|
 |
JLRowe |
Posted: Wed Jun 02, 2010 3:10 am Post subject: |
|
|
 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 |
|
 |
|