MQ connection is terminating with error code 2009.
The connection may be broken for a number of different reasons. The 2009 return code indicates that something prevented a successful connection to the Queue Manager. The most common causes for this are the following are:
1. A firewall that is terminating the connection
2. An IOException that causes the socket to be closed
3. An explicit action to cause the socket to be closed by one end
4. The queue manager is offline
5. The maximum number of channels allowed by the queue manager are open
6. A configuration problem in the Queue Connection Factory (QCF)
Resolving the problem
1. Preventing the firewall from terminating connections:
Configure the Connection Pool and Session Pool settings for the QCF that is configured in IBM WebSphere Application Server so that WebSphere can remove connections from the pool before they are dropped by the firewall. Change the value of Min Connections to 0 and set the Unused Timeout to half the number of seconds as the firewall timeout. For example, if the firewall times out connection after 15 minutes (900 seconds), set the Unused Timeout to 450 seconds.
2. Configuring to minimize the possibility of an IOException:
On a UNIX® system, configure the TCP stanza of the qm.ini for the queue manager to contain this entry:
This setting causes TCP/IP to check periodically that the other end of the connection is still available. If it is not, the channel is closed.
Also follow the instructions for Tuning Operating Systems in the WebSphere Application Server Information Center. These will enable the user to set the operating system configuration for TCP/IP to prevent sockets that are in use from being closed unexpectedly. For example, on Solaris, user sets the TCP_KEEPALIVE_INTERVAL setting on the WebSphere MQ machine. This should be set to be less than the firewall timeout value. If TCP_KEEPALIVE_INTERVAL is not set to be lower than the firewall timeout, then the keepalive packets will not be frequent enough to keep the connection open between WebSphere Application Server and MQ.
NOTE: Check that the firewall is configured to allow keepalive packets to pass through. A connection broken error could be caused by the firewall not letting the keepalive packets through.
3. An explicit action can cause this:
An action such as stopping the queue manager or restarting the queue manager would also cause Reason Code 2009. There are also some MQ defects that could result in unexpected 2009 errors. When this document was written, APARs that addressed these defects included IY59675, IC42636, PQ87316, and PQ93130. It is a good idea to install the latest available Fix Pack for WebSphere MQ or Interim Fix for embedded messaging.
4. The maximum number of channels has been reached:
This could be due to the number of channels for the JMS provider not being large enough, or there could be some errors occurring that are causing channels to not close, so that they cannot be reused. For additional information, refer to these technotes:
WebSphere Application Server and MQ do not agree on the number of JMS connections
5. A QCF configuration problem:
This problem could also occur because of a QCF configuration problem. If the queue manager, host, port, and channel properties are not set correctly, a Reason Code 2009 would occur when an application uses the QCF to connect to the queue manager.