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 :
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().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) ...
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


Reply With Quote
