Announcement Announcement Module
Collapse
No announcement yet.
MessageProducer & MessageConsumer leaks in CachingConnectionFactory & Websphere MQ 7 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MessageProducer & MessageConsumer leaks in CachingConnectionFactory & Websphere MQ 7

    Dear all,

    I discovered that the CachingConnectionFactory has MessageConsumer and MessageProducer leaks with Websphere MQ 7.0.1 JMS connector due to a bug in "MQTopic.hashCode()" and "MQQueue.hashCode()" methods : these "hashCode()" methods don't return the same value for two objects that are equals.

    The symptom is that all "session.createProducer() / session.createConsumer() calls raise a MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2017' ('MQRC_HANDLE_NOT_AVAILABLE')" exception :
    Code:
    Caused by: com.ibm.msg.client.jms.DetailedResourceAllocationException: JMSWMQ2006: 
       Failed to open MQ topic 'MY_TOPIC'. JMS attempted to perform an MQOPEN, but WebSphere MQ reported an error. 
       Use the linked exception to determine the cause of this error. Check that the specified topic and queue manager 
       are defined correctly.  
            at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:588)  
            at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:236)  
            at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1046)  
            at com.ibm.msg.client.wmq.internal.WMQMessageProducer.checkJmqiCallSuccess(WMQMessageProducer.java:1002)  
            at com.ibm.msg.client.wmq.internal.WMQMessageProducer.access$800(WMQMessageProducer.java:63)  
            at com.ibm.msg.client.wmq.internal.WMQMessageProducer$SpiIdentifiedProducerShadow.initialise(WMQMessageProducer.java:763)  
            at com.ibm.msg.client.wmq.internal.WMQMessageProducer.<init>(WMQMessageProducer.java:977)  
            at com.ibm.msg.client.wmq.internal.WMQSession.createProducer(WMQSession.java:943)  
            at com.ibm.msg.client.jms.internal.JmsSessionImpl.createProducer(JmsSessionImpl.java:1162)  
            at com.ibm.mq.jms.MQSession.createProducer(MQSession.java:593)  
            at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.getCachedProducer(CachingConnectionFactory.java:347) 
            at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.invoke(CachingConnectionFactory.java:319) 
            at $Proxy9.createProducer(Unknown Source)  
            at org.springframework.jms.core.JmsTemplate.doCreateProducer(JmsTemplate.java:971)  
            ... 
    Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2017' ('MQRC_HANDLE_NOT_AVAILABLE').  
            at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:223)  
            ...
    I found a workaround wrapping MQ ConnectionFactory, Connection and Session to reimplement hashCode() on the Queue and Topic returned by MQ's Session.createProducer() and session.createConsumer().

    However, waiting for IBM to fix and the customers to upgrade, I would find interesting to introduce in the CachingConnectionFactory a flag to bypass the Destination hashCode() methods and rely instead on Queue.getQueueName().hashCode() and Topic.getTopicName().hashCode()[/FONT] (hashCode() is used by the cachedProducers and cachedConsumers maps for get/put operations).

    If the project is interested in such a patch, I would be very happy to offer one.


    Once I fixed this hashCode() issue, the CachingConnectionFactory worked very well with Websphere MQ 7.0.1 JMS connector under high load (a dozen of 5 Mo messages per second).

    I hope this will spare times and problems to other team :-).


    Cyrille
    Last edited by Cyrille Le Clerc; Jul 6th, 2010, 03:56 PM.

  • #2
    This Websphere MQ 7 problem is tracked by IBM as IZ53893: HASHCODE METHOD MISSING FOR MQDESTINATION IN WEBSPHERE MQ V7 JMSCLIENT and a fix is available in Websphere MQ 7.0.1.2.

    With this fix, the Spring Framework's CachingConnectionFactory works very well with Websphere MQ 7.

    Please note that I didn't have to upgrade the WMQ server but just the jars that are embedded in my java application ; fixing this only requires to upgrade WMQ JMS connector's jars.

    Cyrille

    Comment


    • #3
      I ran into this issue and was able to fix it by using the CachingConnectionFactory from Spring 3.0.3. See
      http://jira.springframework.org/browse/SPR-7148

      Comment

      Working...
      X