I am trying to send Text messages using IBM XMS for .NET. After sending around 254 messages, I get following error:
An unhandled exception of type 'IBM.XMS.XMSException' occurred in IBM.XMS.Client.WMQ.dll
Additional information: CWSMQ0082E: Failed to send to CompCode: 2, Reason: 2017.
There isn't much on google about it. I found one related post at WSMQ Queue Limit
The post suggest that there is some sort of limit in max queues. The links in the post don't seem to work. How do I overcome this error ?
MQ has a command
mqrc
which returns the text for any reason code or message code. The 2017 meansMQRC_HANDLE_NOT_AVAILABLE
. A better explanation can be had by going to the Knowledge Center and searching on 2017. This returns several pages of API calls which can return 2017, along with the page for the reason code itself:2017 (07E1) (RC2017): MQRC_HANDLE_NOT_AVAILABLE.
That page provides the following description of the problem:
We know from the documentation, and can confirm from MQ Explorer's QMgr Extended Properties panel, that by default the maximum handles any process will be allowed to have is 256.
Based on all this and that your program is dying after 254 messages, the conclusion is that it is grabbing a fresh handle for every message being
PUT
and not ever releasing them.Generally this occurs when there is a loop that should contain only the
PUT
andCOMMIT
but instead also contains theOPEN
. I would suggest carefully reviewing your code, possibly also updating your question to post the code here.I would also suggest studying the MQ .Net sample programs or using one of them as the basis for your own code.