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

1.1k Views Asked by At

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.

2

There are 2 best solutions below

1
On BEST ANSWER

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.

2
On

This happens when the connection was closed (could be remote server restart, network issues, etc...). This really takes me back - I remember dealing with this back in 2002 connecting a Java J2EE application to MQ on an OS/390.

Recently IBM has implemented auto reconnect settings that can be set in the CCDT or manually on the C# object. This is summarized on the XMS page, and the documentation for implementing that is here.

The properties Client Reconnect Options, Client Reconnect Timeout, and Connection Namelist can also be set via Client Channel Definitions Table (CCDT) or by enabling the client reconnection via the mqclient.ini file.