Search code examples
c#.netibm-mqxmsapache-nms

MQ Error Reason: 2058 randomly starts occurring in C# .NET client after working correctly for multiple days


Client Details: The issues occurs with code acting as a producer pushing messages into IBM MQ queues and topics. The producer is exposed as a REST interface using WebApi2 and is deployed on IIS. We are using C# .NET (4.5.2) client to connect to IBM MQ. We connect using the CCDT file AMQCLCHL.TAB to get the client connection details. The underlying libraries used are Apache NMS (1.8.0.4573) and IBM XMS (2.5.0.3).

Exception Received: CWSMQ0006E: An exception was received during the call to the method ConnectionFactory.CreateConnection: CompCode: 2, Reason: 2058.

Error Details: The client correctly works and we are able to push hundred thousands messages through to MQ queues and topics. However, after a random period of time ranging from few hours to more than 1 week, the client starts failing with the error noted above. Few more details:

  • The error is resolved by restarting the IIS pool or reloading the application
  • Connecting to the same MQ server from another client (IIS server 2) continues to work when first client (IIS server 1) continues to have issues

Error seen in AMQERR01.LOG file.

AMQ9516: File error occurred.

EXPLANATION: The filesystem returned error code 6 for file'\\...\AMQCLCHL.TAB'. 

ACTION: Record the name of the file '\\...\AMQCLCHL.TAB' and tell the systems administrator, who should ensure that file '\\...\AMQCLCHL.TAB' is correct and available. 

Error code 6 is ERROR_INVALID_HANDLE.


Solution

  • Based on suggestions from @JoshMc, we noticed intermittent errors related to accessing the AMQCLCHL.TAB file on the NAS in the AMQERR01.LOG file. This seemed to mess up the unmanaged client at our end which could only be fixed with an IIS restart. Our setup was updated to move this file to local disk on the server and then point our code to it. This resolved the issue and we have been going strong without issues for the last two weeks since this change was made.