【性能診斷】10、性能問題綜合分析(案例1,windbg、Network Monitor)

【問題描述】:服務器

      產品中某業務功能A,在進行「刷新」—>選擇制單—>新增—>切換其餘行等一系列操做後,忽然發生客戶端不響應的現象。網絡

      經反覆測試驗證發現,在單用戶場景下也會發生,不過一旦客戶端啓用了Fiddler工具,此問題便沒法重現。而且問題發生後,抓取應用服務器的dump文件進行分析,未發現running狀態的線程。工具


【分析過程】:oop

      根據問題描述初步斷定緣由在客戶端或網絡環境上,所以決定採用客戶端抓取dump並同時進行網絡抓包。在問題重現後,抓取客戶端的dump文件,發現客戶端的堆棧信息中能夠看到,獲取Stream後等待流完成。windbg日誌以下:測試

0:000> !clrstack ui

   PDB symbol for clr.dll not loaded spa

   OS Thread Id: 0x3bf8 (0) 線程

   Child SP IP Call Site 日誌

0030e658 77860159 [HelperMethodFrame_1OBJ:0030e658]System.Threading.WaitHandle.WaitOneNative(System.Runtime.InteropServices.SafeHandle, UInt32, Boolean, Boolean) 
0030e73c 6f5d56b1 System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle, 
Int64, Boolean, Boolean) 0030e754 6f5d5684 System.Threading.WaitHandle.WaitOne(Int32 , Boolean) 0030e768 6ea04ef5 System.Net.LazyAsyncResult.WaitForCompletion(Boolean) 0030e798 6ea326ab System.Net.Connection.SubmitRequest(System.Net.HttpWebRequest, Boolean) 0030e7e4 6ea30948 System.Net.ServicePoint.SubmitRequest(System.Net.HttpWebRequest, System.String) 0030e820 6ea30215 System.Net.HttpWebRequest.SubmitRequest(System.Net.ServicePoint) 0030e84c 6ea567d4 System.Net.HttpWebRequest.GetRequestStream(System.Net.TransportContext ByRef) 0030e890 6ea5659e System.Net.HttpWebRequest.GetRequestStream() 0030e898 076f30c6 xxxxxx.Platform.AppFramework.RestfulClientService.HttpRequestNetConnection.Invoke(xxxxxx.Platform.AppFramework.Service.GSPState, System.String, System.String, System.String, Boolean, System.String[]) 0030e90c 076f3044 xxxxxx.Platform.AppFramework.Service.InvokeService.Invoke(xxxxxx.Platform.AppFramework.Service.GSPState, System.String, System.String, System.String, Boolean, System.String[]) 0030e954 1dc33a38 xxxxxx.Platform.XForm.FormWebServiceClient.FormDataAccessServiceProxy.GetObjectXmlByQueryTypeWithParameters(System.String, System.Object, Int32, System.String ByRef, xxxxxx.Platform.AppFramework.Service.GSPState) 0030e978 1dc33917 xxxxxx.Platform.XForm.FormWebServiceClient.FormDataAccessServiceClient.GetObjectXml(System.String, System.Object, xxxxxx.Platform.Engine.DataAccess.ClientSPI.DataQueryType, xxxxxx.Platform.XForm.SPI.TransferState, xxxxxx.Platform.AppFramework.Service.GSPState) 0030e9a0 1dc338c7 xxxxxx.Platform.XFormEngine.Core.ResourceFetcher.GetInstanceXml(System.String, System.Object, xxxxxx.Platform.Resource.Metadata.DataModel.ModelView, xxxxxx.Platform.XForm.SPI.TransferState, xxxxxx.Platform.AppFramework.Service.GSPState) 0030e9c4 1eff4b38 xxxxxx.Platform.XFormEngine.Core.ResourceFetcher.GetInstanceXml(xxxxxx.Platform.XForm.SPI.DataURI, System.String, xxxxxx.Platform.Resource.Metadata.DataModel.ModelView, xxxxxx.Platform.XForm.SPI.TransferState, xxxxxx.Platform.AppFramework.Service.GSPState) 0030e9ec 1eff1614 xxxxxx.Platform.XFormEngine.MLFC.XFML.DOM.InstanceElement.LoadInstanceData(xxxxxx.Platform.XForm.SPI.DataURI) 0030ea44 1eff0c08 xxxxxx.Platform.XFormEngine.MLFC.XFML.DOM.InstanceElement.LoadData(xxxxxx.Platform.XForm.SPI.DataURI) 0030ea7c 1dc33731 xxxxxx.Platform.XFormController.ModelController.CardModelController.LoadData(System.Data.DataRow, Boolean) 0030eaa0 1dc335d2 xxxxxx.Platform.XFormController.FormController.Basic.TreeController.Tree_SelectedChanged(System.Object, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs) 0030eac0 000bd7a7 [MulticastFrame:0030eac0] DevExpress.XtraTreeList.FocusedNodeChangedEventHandler.Invoke(System.Object, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs) 0030eaec 1e06fdfd xxxxxx.Platform.XFormEngine.MLFC.XFML.DOM.TreeElement.OnSelectedNodeChanged(DevExpress.XtraTreeList.FocusedNodeChangedEventArgs) 0030eb00 1e06fd54 xxxxxx.Platform.XFormEngine.MLFC.XFML.DOM.TreeElement.VisualComponent_FocusedNodeChanged(System.Object, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs) 0030eb14 16434f98 DevExpress.XtraTreeList.TreeList.RaiseFocusedNodeChanged(DevExpress.XtraTreeList.Nodes.TreeListNode, DevExpress.XtraTreeList.Nodes.TreeListNode) 0030eb2c 1dec1c32 DevExpress.XtraTreeList.TreeList.InternalSetFocusedRowIndex( Int32) 0030eb74 1dec1590 DevExpress.XtraTreeList.TreeList.set_FocusedRowIndex(Int32) 0030eb84 1e05b27e DevExpress.XtraTreeList.Handler.TreeListHandler+NodePressedState.ChangeSelection(DevExpress.XtraTreeList.ViewInfo.RowInfo) 0030ebac 1e05b038 DevExpress.XtraTreeList.Handler.TreeListHandler+NodePressedState.Init() 0030ebd0 162dfe7e DevExpress.XtraTreeList.Handler.TreeListHandler.SetControlState(DevExpress.XtraTreeList.TreeListState) 0030ebe0 1e05aeff DevExpress.XtraTreeList.Handler.TreeListHandler+NormalState.OnPressNode() 0030ebe4 1e05adc0 DevExpress.XtraTreeList.Handler.TreeListHandler+NormalState.MouseDown(System.Windows.Forms.MouseEventArgs, DevExpress.XtraTreeList.TreeListHitTest) 0030ec0c 1e05ac52 DevExpress.XtraTreeList.Handler.TreeListHandler.OnMouseDown(System.Windows.Forms.MouseEventArgs) 0030ec34 1e05abca DevExpress.XtraTreeList.TreeList.OnMouseDown(System.Windows.Forms.MouseEventArgs) 0030ec58 557f09bb System.Windows.Forms.Control.WmMouseDown(System.Windows.Forms.Message ByRef, System.Windows.Forms.MouseButtons, Int32) 0030ec74 552e57d3 System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef) 0030ec78 16431287 [InlinedCallFrame:0030ec78] 0030ecb8 16431287DevExpress.XtraEditors.Container.EditorContainer.WndProc(System.Windows.Forms.Message ByRef) 0030eccc 164311a5 DevExpress.XtraTreeList.TreeList.WndProc(System.Windows.Forms.Message ByRef) 0030ecdc 552e5263 System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef) 0030ece4 552e51e1 System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef) 0030ecf8 552e50f6 System.Windows.Forms.NativeWindow.Callback(IntPtr, 
Int32, IntPtr, IntPtr) 0030ee84 000cd30a [InlinedCallFrame:0030ee84] 0030ee80 5530548c DomainBoundILStubClass.IL_STUB_PInvoke(MSG ByRef) 0030ee84 552f6292 [InlinedCallFrame: 0030ee84] System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef) 0030eeb8 552f6292 System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32) 0030eebc 552f5e6a [InlinedCallFrame:0030eebc] 0030ef44 552f5e6a System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner( Int32, System.Windows.Forms.ApplicationContext) 0030ef88 552f5bd0 System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext) 0030efb4 55286981 System.Windows.Forms.Application.Run(System.Windows.Forms.Form) 
0030efc8 1e72c14f xxxxxx.Platform.AppFrameworkGui.Commands.StartWorkbenchCommand.Run(System.String[]) 0030efdc 12b8b5d6 *** 
WARNING:Unable to verify checksum for GSFramework.exe *** ERROR: Module load completed but symbols couldnot 
be loaded for GSFramework.exe xxxxxx.Platform.FrameworkGui.Portal.FrameworkMain.RunApplication() 0030f004 0020c2e5 xxxxxx.Platform.FrameworkGui.Portal.FrameworkMain.Run() 0030f094 00201b05 xxxxxx.Platform.FrameworkGui.Portal.FrameworkMain.Main(System.String[]) 0030f2a0 70461276 [GCFrame: 0030f2a0]


      同時打開Network Monitor的網絡抓包,結果發現客戶端最後的http請求中包含invokeStream的字樣。請求文本的內容中包含:XXXXXX.TB.ZXYJ.Com.XXXXXX.TB.ZXYJ.Com.TBDYGXCom.AddLB命名空間、方法等信息。code

image


      根據請求中的代碼關鍵字找到客戶端dll文件,反射查看代碼內容發現,該方法調用了InvokeStream流操做但並未關閉,進而形成客戶端掛起。

image


【問題解決】:

       修改代碼,使用using或finally關閉流操做,測試驗證無問題,問題解決。

image

相關文章
相關標籤/搜索