ImportMQMDMesageBuffer 中的缓冲区为空,导致客户端应用程序崩溃

Buffer is null in ImportMQMDMesageBuffer, causes client application to crash

我们遇到了一个棘手的问题,希望有人能指点一下如何解决这个问题。

我们在日志记录中遇到以下 XMSException:

IBM.XMS.XMSException: CWSMQ0282E: A null value has been used for argument BUFFER = <> NULL within method ImportMQMDMesageBuffer(WmqSession, WmqDestination, MQMD,byte[],int,int). 
The preceding method detected an invalid  null argument. 
If necessary, recode the application to avoid the error condition. 
   at IBM.XMS.Client.WMQ.WmqReceiveMarshal.ImportMQMDMesageBuffer(MQMessageDescriptor mqmd, Byte[] buffer, Int32 dataStart, Int32 dataEnd) 
   at IBM.XMS.Client.WMQ.WmqAsyncConsumerShadow.Consumer(Phconn hconn, MQMessageDescriptor mqmd, MQGetMessageOptions mqgmo, Byte[] pBuffer, MQCBC mqcbc) 
   at IBM.WMQ.Nmqi.UnmanagedNmqiMQ.NmqiConsumerMethodUM(Int32 hconn, IntPtr structMqmd, IntPtr structMqgmo, IntPtr buffer, IntPtr structMqcbc)

在此 XMSException 之后,Windows 服务崩溃。困难的部分是我们无法在我们的开发环境中重现这种行为。我们仍在进行故障排除,我们找不到此问题的根本原因。

您可以在下面找到有关我们如何建立联系的信息:

使用的版本:IBM.XMS 8.0.0.5

连接是这样创建的:

XMSFactoryFactory factory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ); 
IConnectionFactory cf = factory.CreateConnectionFactory(); 
cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED); 
cf.SetStringProperty(XMSC.WMQ_HOST_NAME, hostname); 
cf.SetStringProperty(XMSC.WMQ_PORT, port); 
cf.SetStringProperty(XMSC.WMQ_CHANNEL, channelname); 
cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, qmname); 
IConnection connection = cf.CreateConnection(); 

会话是这样创建的:

ISession session = connection.CreateSession(false, AcknowledgeMode.AutoAcknowledge);

目标是这样创建的:

destination = session.CreateQueue("queuename"); 
destination.SetIntProperty(XMSC.WMQ_MESSAGE_BODY, XMSC.WMQ_MESSAGE_BODY_MQ); 
destination.SetBooleanProperty(XMSC.WMQ_MQMD_WRITE_ENABLED, true); 
destination.SetBooleanProperty(XMSC.WMQ_MQMD_READ_ENABLED, true);

侦听器是这样创建的:

IMessageConsumer consumer = session.CreateConsumer(destination); 
consumer.MessageListener = listenerDelegate;

同样的XMSException几年前也问过here。我看到他们已经为这个问题打开了一个 PMR,但是没有任何更新...

2019 年 3 月 28 日,IBM 发布了一个 APAR,它似乎与您报告的问题完全匹配。

IT28062: While getting an empty message, XMS .Net applications reports CWSMQ0282E and crash.

遗憾的是,APAR 未包含在 MQ 的任何当前版本中(截至 3 月 29 日)。您将需要等待包含此 APAR 的版本发布,或者让您的客户打开 PMR 并要求他们针对您正在使用的 MQ 版本为此 APAR 提供 IFIX。

APAR 针对以下维护级别,我还添加了每个级别的目标日期 IBM MQ planned maintenance release dates

Version    Maintenance Level   Planned Release Date
v8.0       8.0.0.12            2Q 2019
v9.0 LTS   9.0.0.7             2Q 2019
v9.1 LTS   9.1.0.3             Not noted yet, 9.1.0.2 is targeted for 2Q 2019
v9.1 CD    9.1.3               CD releases historically have been between
                               2 and 6 months apart.
                               9.1.2 was released March 21 2019.