IBM MQ: CWSMQ0082E: Failed to submit to CompCode: 2, reason: 2017
I am trying to send text messages using IBM XMS for .NET. After sending about 254 messages, I get the 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.
Not much is said about this on google. I found one related post on WSMQ Queue Limiting
The message suggests there is some kind of limit in the maximum queues. The links in the post don't seem to work. How to overcome this error?
source to share
MQ has a command mqrc
that returns text for a reason code or a message code. 2017 means MQRC_HANDLE_NOT_AVAILABLE
. The best explanation can be obtained by going to Knowledge Center and searching in 2017. This returns several pages of API calls that might return 2017, along with a page of the reason code itself:
2017 (07E1) (RC2017): MQRC_HANDLE_NOT_AVAILABLE .
This page provides the following description of the problem:
Explanation
An MQOPEN, MQPUT1, or MQSUB call has exited, but the maximum number of open grips allowed for the current task has already been reached. Be aware that when the mailing list is specified in the call to MQOPEN or MQPUT1, each queue in the distribution list uses one descriptor.
We know from the documentation and can confirm from the MQ Explorer QMgr advanced properties panel that by default the maximum descriptors of any process will be 256.
Based on all this and that your program dies after 254 messages, the conclusion is that it grabs a new handle for every message PUT
and never releases them.
This usually happens when there is a loop that should only contain PUT
and COMMIT
, but instead also contains OPEN
. I would suggest taking a close look at your code, perhaps also updating my question to post the code here.
I would also suggest looking into the MQ.Net sample programs or using one of them as a basis for your own code.
source to share