我們有一個將消息發佈到我們的RabbitMQ服務器的ASP.Net WebAPI 2.0應用程序。在99%的情況下,一切都很好......但是隨機應用終止,出現無理由的System.AccessViolationException。RabbiMQ C#驅動程序導致System.AccessViolationException
如何防止此故障?它可能與我們最近升級到3.6.6 C#驅動程序(在升級之前它工作正常)有關嗎?
事情我已經消除:
- 新
IModel
用於每個發佈(我知道IModel
不是線程 安全) - 呼叫要
CreateConnection
由每個呼叫,以及(我 知道我可以重新使用連接,但我們目前不)。該連接是AutoClose = true;
- 的信道是在使用塊中使用...所以每次
下面是其中它爆炸的樣品堆棧跟蹤它設置:
異常詳細信息
System.AccessViolationException
嘗試讀取或寫保護 內存。這通常表明其他內存已損壞。
在System.Net.UnsafeNclNativeMethods.SafeNetHandlesXPOrLater.GetAddrInfoW(字符串 節點名,絃樂服務名,AddressInfo的&提示,SafeFreeAddrInfo & 手柄) 在System.Net.Dns.TryGetAddrInfo(字符串名稱,AddressInfoHints標誌,IPHostEntry & Hostinfo中) at System.Net.Dns.InternalGetHostByName(String hostName,Boolean includeIPv6) at System.Net.Dns.GetHostAddresses(String hostNameOrAddress) at RabbitMQ.Client.TcpClientAdapter.BeginConnect(String host,Int32 port,AsyncCallback requestCallback,Object狀態) at RabbitMQ.Client.Impl.SocketFrameHandler.Connect (ITcpClient插座,AmqpTcpEndpoint端點的Int32超時) 在RabbitMQ.Client.Impl.SocketFrameHandler..ctor(AmqpTcpEndpoint端點,Func`2的SocketFactory,的Int32 connectionTimeout,的Int32 readTimeout,的Int32 writeTimeout) 在RabbitMQ.Client.Framing.Impl .ProtocolBase.CreateFrameHandler(AmqpTcpEndpoint 終點,Func'2的SocketFactory,的Int32 connectionTimeout,的Int32 readTimeout,的Int32 writeTimeout) 在RabbitMQ.Client.ConnectionFactory.CreateConnection(IList'1終點,字符串clientProvidedName)
而另一
個System.Net.UnsafeNclNativeMethods + SafeNetHandlesXPOrLater.GetAddrInfoW(System.String, System.String,System.Net.AddressInfo的ByRef, System.Net.SafeFreeAddrInfo的ByRef) System.Net.Dns.TryGetAddrInfo(System.String, System.Net.AddressInfoHints,System.Net.IPHostEntry ByRef) System.Net.Dns.InternalGetHostByName(System。String,Boolean) System.Net.Dns.GetHostAddresses(System.String) RabbitMQ.Client.TcpClientAdapter.BeginConnect(System.String,Int32,System.AsyncCallback,System.Object) RabbitMQ.Client.Impl.SocketFrameHandler.Connect (RabbitMQ.Client.ITcpClient, RabbitMQ.Client.AmqpTcpEndpoint,Int32)將 RabbitMQ.Client.Impl.SocketFrameHandler..ctor(RabbitMQ.Client.AmqpTcpEndpoint, System.Func'2, 的Int32,的Int32,Int32)將 的RabbitMQ .Client.Framing.Impl.ProtocolBase.CreateFrameHandler(RabbitMQ.Client.AmqpTcpEndpoint, System.Func'2, Int32,Int32,Int32) RabbitMQ.Client.ConnectionFactory.CreateConnection(System.Collections.Generic.IList'1, System.String)
感謝您的意見。
我們的實現每次都不會創建一個新的「發件人」類,但我們確實將該通道包裝在一個使用中。
爲了記錄,我的實施工作已經進行了3年,沒有問題......最近剛剛開始失敗。也許這是我剛剛升級到的驅動程序版本中的一個錯誤(3.6.6)
–
您運行的是什麼版本的RabbitMQ。我們在3.6.4中發現了幾個問題。主要的原因是心臟跳動導致客戶端出現故障,並會中斷連接。 (固定在3.3.6我相信根據補丁說明)根據你的錯誤處理,這可能是它。只有通過Windows事件日誌纔會注意到它,該錯誤列出了源自.NET rabbitmq客戶端的錯誤,並將「heartbeats」作爲問題。 – Kelly
我們的驅動程序是3.6.6 ....不確定服務器,但我可以檢查。 –