AMQ9513: Maximum number of channels reached[Channel达到最大连接数]

AMQ9513: Maximum number of channels reached

 

Question

 

You would like to know more details regarding the following WebSphere MQ error message:
AMQ9513: Maximum number of channels reached

 

Answer

 

The error AMQ9513 (Maximum number of channels reached. ) is reported in the MQ queue manager error logs when a client application attempts to connect to the queue manager and the specified maximum number of channels are in use. There are three causes for this:

For items 1 and 2 below, the MQ administrator needs to contact the application administrators or developers to determine the maximum number of channels needed and if the application needs to be changed.

1. MAXCHANNELS are set too low for the required number of client connections (default is 100). This is specified in the in the Channels stanza in the qm.ini file of the queue manager

In Unix: /var/mqm/qmgrs//qm.ini

In Windows:
– Before version 7.1 all MQ configuration information, and most queue manager configuration information, was stored in the Windows registry. From version 7.1 onwards all configuration information is stored in files.
– For MQ 7.1 and later (7.5), the location of the qm.ini file is given by the WorkPath specified in the HKLM\SOFTWARE\IBM\WebSphere MQ key. For example, the path and the name for a configuration file for a queue manager called QMNAME is:
C:\Program Files\IBM\WebSphere MQ\qmgrs\QMNAME\qm.ini

If you determine that the value set for MAXCHANNELS is not sufficient, then increase the value. This will reserve the needed system resources. This may also provide a work-around to an application problem until it can be fixed.

2. Client applications are holding the channels open longer than needed, thereby not freeing up the channels for other application to use.

3. Client applications are not freeing the channels via MQDISC before terminating. This can occur if the application, or client system, is killed or if there are network glitches.

In MQ 6.0, this item was a leading cause for reaching the max channels condition. “Orphaned” channels were not killed by the queue manager because the queue manager could not communicate with the client due to the half-duplex nature of server-connection channels in V6.

In MQ 7.x, with the introduction of full-duplex channels, the queue manager can now ask periodically via a heartbeat if the client at the other end of the channel is still alive. If not alive anymore, then the connection is terminated, eliminating “orphan” channels.

However, even when using MQ 7.x, if the server-connection channel has SHARECNV equal to 0, then the channel is half-duplex, and it could cause “orphaned” channels. The same happens if the client specifies PROVIDERVERSION equals 6 (for version 6).

In MQ 6 or when using MQ V7 with SHARECNV = 0 (or PROVIDERVERSION 6), then the MQ administrator can implement KeepAlive. This will bring down any channels where the originating application/system has terminated or where a network problem terminated the connection.

The ClientIdle parameter is recommended for half-duplex channels (V6 or V7 with SHARECNV=0). When using full-duplex channels in V7, there is no need for it. It is an undocumented attribute for the qm.ini file.

 

【上面的内容是IBM官方网站关于此问题的一些描述。这是服务器端的错误消息,客户端显示错误消息如下:】

 

15:10:32.361-[DEBUG] JMSCCThreadPoolWorker-200 JmsMQConnection – Exception Msg: CC=2;RC=2537;AMQ9558: 主机“”上的程通道“‘‘”当前不可用。 [3=]
15:10:32.362-[DEBUG] JMSCCThreadPoolWorker-200 JmsMQConnection – WMQ Log Message: 14-5-23 15:10:32 – User(USER) Program(java)
AMQ9558:
主机“”上的程通道“‘‘”当前不可用。

 

==================以下内容是自己解决的方法======================================

 

项目中使用到了MQ,运行一段时间就发生此异常,查看如下log文件:

 

/var/mqm/qmgrs/MQJTC/errors/AMQERR01.LOG

 

 

和上面的异常内容一样,只是我这里是日文的界面。

 

对于这种连接达到最大数的解决办法,从网上搜到的都是建议修改设置,将MaxChannels设置的大一点。但我想这并不解决根本问题啊。

 

找到为什么达到了最大值才比较有意义,因为自己的环境下,连接数不应该达到默认的最大值100.

 

比较多的说法是Client端的应用没有正常关闭Channel的连接,造成了MQ服务器端产生一堆僵尸Channel。分析过我的项目代码后,发现在Web App中,Servlet init时就创建了连接,而到destroy时才关闭连接。而大家的开发环境下,都习惯了在Eclipse中直接停止Web Server进程,而没有使用shutdown之类的命令来停止,所以可能才造成了这样的问题。

 

好了,问题原因大概找到了,眼下的问题如何处理呢?MQ是客户的环境,不敢直接重启整个Channel,一顿搜索后,找到了以下办法:

 

1、首先进入MQ的命令控制台(不同环境下,此路径可以不同,但此命令是一定存在的)

 

/usr/mqm/bin/runmqsc

 

2、查看问题Channel

 

DIS CHS()

 

此时会显示出此Channel所有被打开的”连接”(不知道这词对不)。

 

 

3、需要判断出哪些IP是自己环境造成的,并且已经可以不使用的,使用命令强制关闭它

 

STOP CHANNEL() CONNAME() MODE(FORCE)

 

4、提醒成员今后要正确操作Web Server(Web App)的停止

 

完毕。