Windbg分析高内存占用问题

2023-11-04

  1. 打Dump
    远程客户应用服务器,32G内存占用已经消耗了78%,而现场已经反馈收银系统接近奔溃了,要求先强制回收内存。反正也要奔溃了,先打Dump再说吧。
    (PS:打Dump会挂起进程,导致应用无法响应!而打Dump的耗时,也是根据当时进程的内存占用有关,内存占用越大,耗时越久。)
    打开任务管理器,选择对应的IIS进程,右键创建转储文件(Dump)。
    打Dump

结果,Dump文件是生成的,结果当分析的时候,发现Windbg提示Dump无效。说明Dump文件创建的有问题。观察任务管理器,发现内存占用一下就降下来了,原来是之前的进程直接奔溃了,重启了一个W3WP进程。

既然直接从任务管理器无法创建,就使用第三方工具收集Dump吧。经过Goggle,找到一款很好用的Dump收集工具ProcDump,是一个命令行应用,其主要用途是监视应用程序的CPU或内存峰值并在峰值期间生成Dump。

因为是高内存占用问题,我们使用以下命令来抓取dump:
(PS:可以使用进程名称,也可以使用进程ID来指定要创建Dump的进程。当有多个相同名称的进程时,必须使用进程ID来指定!)

procdump w3wp -m 20480 -o D:\Dumps (当内存超过20G时抓取一个w3wp进程的MiniDump)

上面就是我踩得第一个坑,因为默认抓取的是MiniDump,很快就抓下来,文件也很小,正在我得意的时候,Windbg加载Dump分析的时候,发现包含的信息很少,根本无法进行进一步的分析。

调整创建Dump的命令,添加-ma参数即可创建完整Dump。

procdump w3wp -ma -m 20480 -o D:\Dumps (当内存超过20G时抓取一个w3wp进程的完整Dump)

结果再一次,当内存占用到达20G,占比80%的时候,Dump再次创建失败,提示:Procdump Error writing dump file。再一次感觉到绝望。不过至少有错误提示,Google一把,果然存在天涯沦落人。Procdump Error writing dump file: 0x80070005 Error 0x80070005 (-2147024891): Access is denied。大致的意思是说,当90S内Dump文件没有成功创建的话(也就意外这w3wp进程被挂起了90s),IIS检测到w3wp进程挂起超过90s没有响应就会终止进程,重现创建一个新的进程。好嘛,真是处处是坑。

这个坑,也让我开始真正停下来思考问题。罗马不是一日建成的,内存也不是一下撑爆的。我干嘛死脑筋非要到内存占用超过80%才去打Dump呢呢呢???!

焕然大悟,如醍醐灌顶。

procdump w3wp -ma -m 8000 -o D:\Dumps (当内存超过8000M时抓取一个w3wp进程的完整Dump,并输出到D:\Dumps文件夹)

此时内存占用在40%左右,这次Dump终于成功创建了。

2…分析Dump
分析Dump,上WinDbg。如果对WinDbg不理解,可以看我这篇WinDbg学习笔记。

接下来就是一通命令乱敲,我尽量解释清晰。

0:000> !dumpheap -stat //检查当前所有托管类型的统计信息

00007ffdb9387a98 777101 69462436 System.Char[]
00007ffdb938c988 588917 115563505 System.Byte[]
00007ffdb9389220 1026406 119828936 System.Int32[]
00007ffdb93516a8 663559 128819040 System.Collections.Generic.Dictionary2+Entry[[System.String, mscorlib],[System.Object, mscorlib]][] 00000218c6c30a80 6436865 197832116 Free 00007ffdae9cc240 23171 273333144 System.Collections.Generic.HashSet1+Slot[[System.String, mscorlib]][]
00007ffdb9391f28 13885170 333244080 System.Boolean
00007ffd5c24a068 14003455 560138200 Kingdee.BOS.JSON.JSONArray
00007ffdb9386fc0 14373648 1393615400 System.Object[]
00007ffdb9386948 76146065 4000287202 System.String
Total 138435970 objects
使用dumpheap -stat命令查看当前所有托管类型的统计信息。从输出的结果来看:

其中占用内存最多当属System.String类型,接近4G的大小(是不是很吃惊?!)。
其次System.Object[]类型占有1.3G大小。
Kingdee.BOS.JSON.JSONArray类型也大概占用了560M。
我们首先来分析占用最多的System.String类型,看看有什么发现。

0:000> !dumpheap -mt 00007ffdb9386948 -min 200 //查看200byte以上的string
Address MT Size

0000021bcbaf5158 00007ffdb9386948 1140
0000021d375d1038 00007ffdb9386948 149698
0000021d375f5920 00007ffdb9386948 149698
0000021d3765b138 00007ffdb9386948 149706
0000021d37f739c8 00007ffdb9386948 217120
0000021d37fa8a08 00007ffdb9386948 190162
0000021d38047330 00007ffdb9386948 1224698
0000021d3829d348 00007ffdb9386948 1224698
0000021d386bd678 00007ffdb9386948 2610994
0000021d38bb8500 00007ffdb9386948 2610994

Statistics:
MT Count TotalSize Class Name
00007ffdb9386948 10991 76632628 System.String
Total 10991 objects
从上面的输出可以发现:

单个System.String类型最大占用2M以上。
超过200byte的字节的大小的System.String总大小也不过76M。(所以我们也不必深究大的String对象。)
那我们索性挑一个小点的对象来看看存储的是什么字符串,来满足一下我们的好奇心。

0.000> !do 0000021bcbaf5158 //使用!do命令查看一个对象的内容
Name: System.String
MethodTable: 00007ffdb9386948
EEClass: 00007ffdb8c850e0
Size: 1140(0x474) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String: 5b13710029d012False2052_T_BD_MATERIAL_MATERIAL.FAuxPropertyIdFBaseUnitIdFCategoryIDFChargeIDFCheckIncomingFDefaultVendorFErpClsIDFInvPtyIdFIsAffectPlanFIsAffectPlan1FIsBatchManageFIsComControlFIsEnableFIsEnable1FIsExpParToFlotFIsInventoryFIsPRFIsReturnMaterialFIsSourceControlFIsVmiBusinessFNameFNumberFPlanModeFPurchasePriceUnitIdFPurchaseUnitIdFPurPriceURNomFPurPriceURNumFPurURNomFPurURNumFReceiveAdvanceDaysFReceiveDelayDaysFReceiveMaxScaleFReceiveMinScaleFSalePriceUnitIdFSaleUnitIdFSpecificationFStockIdFStockPlaceIdFStoreUnitIDFTaxTypeFUseOrgId111193
Fields:
MT Field Offset Type VT Attr Value Name
00007ffdb9389288 400026f 8 System.Int32 1 instance 557 m_stringLength
00007ffdb9387b00 4000270 c System.Char 1 instance 35 m_firstChar
00007ffdb9386948 4000274 90 System.String 0 shared static Empty
>> Domain:Value 00000218c6c4d220:NotInit 0000021d52d81840:NotInit <<
似乎是基础资料字段信息。那接下来使用!gcroot命令查看其对应的GC根,看看到底是什么对象持有其引用,导致占用内存得不到释放。

0:000> !gcroot 0000021bcbaf5158 //使用!gcroot 查看一个对象的gc根
HandleTable:
00000218c6ff15e8 (pinned handle)
-> 0000021cc75ebe68 System.Object[]
-> 0000021bc7629a10 Kingdee.BOS.Cache.KCacheManagerFactory
-> 0000021bc7629ab8 System.Collections.Generic.Dictionary2[[System.String, mscorlib],[Kingdee.BOS.Cache.AbstractKCacheManager, Kingdee.BOS]] -> 0000021c4da6fa48 System.Collections.Generic.Dictionary2+Entry[[System.String, mscorlib],[Kingdee.BOS.Cache.AbstractKCacheManager, Kingdee.BOS]][]
-> 00000218c83861b8 Kingdee.BOS.Cache.KCacheManager
-> 00000218c8386630 Kingdee.BOS.Cache.ECache.ECacheManager
-> 00000218c83866e8 System.Collections.Concurrent.ConcurrentDictionary2[[System.String, mscorlib],[System.Collections.Generic.HashSet1[[System.String, mscorlib]], System.Core]]
-> 0000021bcbae0c70 System.Collections.Concurrent.ConcurrentDictionary2+Tables[[System.String, mscorlib],[System.Collections.Generic.HashSet1[[System.String, mscorlib]], System.Core]]
-> 0000021bcbad0128 System.Collections.Concurrent.ConcurrentDictionary2+Node[[System.String, mscorlib],[System.Collections.Generic.HashSet1[[System.String, mscorlib]], System.Core]][]
-> 0000021bcbb34bf8 System.Collections.Concurrent.ConcurrentDictionary2+Node[[System.String, mscorlib],[System.Collections.Generic.HashSet1[[System.String, mscorlib]], System.Core]]
-> 0000021bcbada790 System.Collections.Concurrent.ConcurrentDictionary2+Node[[System.String, mscorlib],[System.Collections.Generic.HashSet1[[System.String, mscorlib]], System.Core]]
-> 0000021a49766460 System.Collections.Generic.HashSet1[[System.String, mscorlib]] -> 00000219540976b0 System.Collections.Generic.HashSet1+Slot[[System.String, mscorlib]][]
-> 0000021bcbaf5158 System.String

Found 1 unique roots (run ‘!GCRoot -all’ to see all roots).
从以上输出可以看出:

该String类型被一个Hashset所持有。
从Cache关键字可以看出该String类型是被缓存所持有。
分析到这里,我们大致可以得出一个结论:

String类型占用4G内存,绝大多数是由缓存所占用,才导致String类型得不到释放。

那我们是不是可以猜测内存占用持续走高是不是被缓存撑爆的呢?。

带着这个疑问我们来继续分析下Kingdee.BOS.JSON.JSONArray类型。

0:000> !dumpheap -mt 00007ffd5c24a068 //输出托管堆上的所有JSONArray对象
Address MT Size

0000021975972b48 00007ffd5c24a068 40
00000218c933f060 00007ffd5c24a068 40
00000218c7605990 00007ffd5c24a068 40
00000218c7605af0 00007ffd5c24a068 40
00000218c7605c50 00007ffd5c24a068 40
00000218c7605e18 00007ffd5c24a068 40
00000218c7605fa0 00007ffd5c24a068 40
00000218c7606198 00007ffd5c24a068 40
00000218c7606338 00007ffd5c24a068 40
00000218c76064b0 00007ffd5c24a068 40
User interrupt.
从输出结果来看:

满屏都是40byte的JSONArray。只能使用Ctrl+Break命令中止输出。
但为了保险期间,我们来验证下有没有100byte以上的JSONArray。

0:000> !dumpheap -mt 00007ffd5c24a068 -min 100
Address MT Size

Statistics:
MT Count TotalSize Class Name
Total 0 objects
这时我们可以大胆猜测所有的JSONArray对象都是40byte。从而可以得出另一个猜测占用560M内存的JSONArray,都具有相似的对象结构。接下来我们来验证这个猜测。随机选择几个对象,看看其内容具体是什么。

0:000> !DumpObj /d 0000021975972b48 //查看第一个JSONArray
Name: System.Object[]
MethodTable: 00007ffdb9386fc0
EEClass: 00007ffdb8d4aa00
Size: 88(0x58) bytes
Array: Rank 1, Number of elements 8, Type CLASS (Print Array)
Fields:
None
从输出可以看出:

JSONArray实质是System.Object[]类型。
对应的MethodTable: 00007ffdb9386fc0。
如果你记性好的话,我们应当还记得占用内存第二多的就是这个System.Object[]类型,占用1.3G。翻到上面,你可以发现其MethodTable和上面的统计信息是一致的。
(PS:到这里我们是不是可以猜测:System.Object[]占用的内存无法释放,就是由于被JSONArray持有引用导致的呢?)

既然是数组,就使用!DumpArray 命令来解开数组的面纱。

0:000> !DumpArray /d 0000021975972b48
Name: System.Object[]
MethodTable: 00007ffdb9386fc0
EEClass: 00007ffdb8d4aa00
Size: 88(0x58) bytes
Array: Rank 1, Number of elements 8, Type CLASS
Element Methodtable: 00007ffdb9386f28
[0] 0000021975972a08
[1] 0000021975972a70
[2] 0000021975972a40
[3] 0000021ac75e87b8
[4] 0000021975972b10
[5] 0000021975972ba0
[6] null
[7] null
0:000> !DumpObj /d 0000021975972a08
Name: System.String
MethodTable: 00007ffdb9386948
EEClass: 00007ffdb8c850e0
Size: 54(0x36) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String: 555d8ca25a6261
Fields:7
MT Field Offset Type VT Attr Value Name
00007ffdb9389288 400026f 8 System.Int32 1 instance 14 m_stringLength
00007ffdb9387b00 4000270 c System.Char 1 instance 35 m_firstChar
00007ffdb9386948 4000274 90 System.String 0 shared static Empty
>> Domain:Value 00000218c6c4d220:NotInit 0000021d52d81840:NotInit <<
从以上输出可以看出,其共有8个子项,我们再随机挑几个子项看看是什么内容。

0:000> !DumpObj /d 0000021975972a70
Name: System.String
MethodTable: 00007ffdb9386948
EEClass: 00007ffdb8c850e0
Size: 42(0x2a) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String: FHTZDLB
Fields:
MT Field Offset Type VT Attr Value Name
00007ffdb9389288 400026f 8 System.Int32 1 instance 8 m_stringLength
00007ffdb9387b00 4000270 c System.Char 1 instance 50 m_firstChar
00007ffdb9386948 4000274 90 System.String 0 shared static Empty
>> Domain:Value 00000218c6c4d220:NotInit 0000021d52d81840:NotInit <<
0:000> !DumpObj /d 0000021975972a40
Name: System.String
MethodTable: 00007ffdb9386948
EEClass: 00007ffdb8c850e0
Size: 42(0x2a) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String: 发货通知单列表
Fields:
MT Field Offset Type VT Attr Value Name
00007ffdb9389288 400026f 8 System.Int32 1 instance 8 m_stringLength
00007ffdb9387b00 4000270 c System.Char 1 instance 6279 m_firstChar
00007ffdb9386948 4000274 90 System.String 0 shared static Empty
>> Domain:Value 00000218c6c4d220:NotInit 0000021d52d81840:NotInit <<
我们可以看到一个字符串内容是FHTZDLB,另一个是发货通知单列表。看到这,我立马就条件反射的想到,这不就是我们的菜单信息嘛。为了验证我的想法,连续查看几个JSONArray,都是相似的内容。

这时,我们继续发扬敢猜敢做的精神。是不是内存被菜单缓存撑爆的?!

为了验证这一猜测,我们继续从Dump中寻找佐证。使用~* e!clrstack来看看所有线程的调用堆栈吧。

0:000> ~* e!clrstack
OS Thread Id: 0x11dc (0)
Unable to walk the managed stack. The current thread is likely not a
managed thread. You can run !threads to get a list of managed threads in
the process
Failed to start stack walk: 80070057
OS Thread Id: 0x2b2c (28)
Child SP IP Call Site
00000076cff7ecc8 00007ffdca2e6bf4 [HelperMethodFrame_1OBJ: 00000076cff7ecc8] System.Threading.WaitHandle.WaitMultiple(System.Threading.WaitHandle[], Int32, Boolean, Boolean)
00000076cff7ee00 00007ffdb91af67c System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle[], Int32, Boolean) [f:\dd\ndp\clr\src\BCL\system\threading\waithandle.cs @ 454]
00000076cff7ee60 00007ffdb201b2fb System.Net.TimerThread.ThreadProc()
00000076cff7ef10 00007ffdb915ca72 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) [f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs @ 954]
00000076cff7efe0 00007ffdb915c904 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) [f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs @ 902]
00000076cff7f010 00007ffdb915c8c2 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) [f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs @ 891]
00000076cff7f060 00007ffdb9196472 System.Threading.ThreadHelper.ThreadStart() [f:\dd\ndp\clr\src\BCL\system\threading\thread.cs @ 111]
00000076cff7f2b8 00007ffdbb4f6793 [GCFrame: 00000076cff7f2b8]
00000076cff7f608 00007ffdbb4f6793 [DebuggerU2MCatchHandlerFrame: 00000076cff7f608]
00000076cff7f798 00007ffdbb4f6793 [ContextTransitionFrame: 00000076cff7f798]
00000076cff7f9c8 00007ffdbb4f6793 [DebuggerU2MCatchHandlerFrame: 00000076cff7f9c8]

OS Thread Id: 0x1bd4 (133)
Child SP IP Call Site
GetFrameContext failed: 1
0000000000000000 0000000000000000
OS Thread Id: 0x1a98 (134)
Child SP IP Call Site
00000076dbdbcc88 00007ffdca2e6124 [InlinedCallFrame: 00000076dbdbcc88] .SNIReadSyncOverAsync(SNI_ConnWrapper*, SNI_Packet**, Int32)
00000076dbdbcc88 00007ffdaaaf5dd4 [InlinedCallFrame: 00000076dbdbcc88] .SNIReadSyncOverAsync(SNI_ConnWrapper*, SNI_Packet**, Int32)
00000076dbdbcc60 00007ffdaaaf5dd4 DomainNeutralILStubClass.IL_STUB_PInvoke(SNI_ConnWrapper*, SNI_Packet**, Int32)
00000076dbdbcd10 00007ffdaab08fe3 SNINativeMethodWrapper.SNIReadSyncOverAsync(System.Runtime.InteropServices.SafeHandle, IntPtr ByRef, Int32)
00000076dbdbcd70 00007ffdaabe0ae0 System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()
00000076dbdbcdd0 00007ffdaabe09dd System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket()
00000076dbdbce10 00007ffdaabdf7f5 System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer()
00000076dbdbce50 00007ffdaabdfa0e System.Data.SqlClient.TdsParserStateObject.TryReadByte(Byte ByRef)
00000076dbdbce90 00007ffdaabc7daa System.Data.SqlClient.TdsParser.TryRun(System.Data.SqlClient.RunBehavior, System.Data.SqlClient.SqlCommand, System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.BulkCopySimpleResultSet, System.Data.SqlClient.TdsParserStateObject, Boolean ByRef)
00000076dbdbcff0 00007ffdaabbb3c7 System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
00000076dbdbd050 00007ffdaabb8325 System.Data.SqlClient.SqlDataReader.get_MetaData()
00000076dbdbd0a0 00007ffdaab3be73 System.Data.SqlClient.SqlCommand.FinishExecuteReader(System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.RunBehavior, System.String, Boolean, Boolean)
00000076dbdbd110 00007ffdaab3b75f System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, Boolean, Int32, System.Threading.Tasks.Task ByRef, Boolean, Boolean, System.Data.SqlClient.SqlDataReader, Boolean)
00000076dbdbd1f0 00007ffdaab3a763 System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, System.String, System.Threading.Tasks.TaskCompletionSource1, Int32, System.Threading.Tasks.Task ByRef, Boolean ByRef, Boolean, Boolean) 00000076dbdbd2c0 00007ffdaab3a49b System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, System.String) 00000076dbdbd360 00007ffdaab35cc6 System.Data.SqlClient.SqlCommand.ExecuteReader(System.Data.CommandBehavior, System.String) 00000076dbdbd3f0 00007ffd5c517ead Kingdee.BOS.App.Data.AbstractDatabase.DoExecuteReader(System.Data.Common.DbCommand, System.Data.CommandBehavior) 00000076dbdbd450 00007ffd5c515ebb Kingdee.BOS.App.Data.AbstractDatabase.ExecuteReader(System.Data.Common.DbCommand, System.Collections.Generic.IEnumerable1, System.Data.CommandBehavior, Boolean)
00000076dbdbd4d0 00007ffd5c4fd6f2 Kingdee.BOS.App.Data.AbstractDatabase.ExecuteReader(System.Data.Common.DbCommand, System.Collections.Generic.IEnumerable1, System.Data.CommandBehavior) 00000076dbdbd500 00007ffd5c4e31b1 Kingdee.BOS.App.Data.DBUtils.ExecuteReader(Kingdee.BOS.Context, System.String, System.Collections.Generic.IEnumerable1, System.Data.CommandType, System.Data.CommandBehavior, Boolean)
00000076dbdbd570 00007ffd5c51d2a7 Kingdee.BOS.App.Data.DBUtils.ExecuteReader(Kingdee.BOS.Context, System.String, System.Collections.Generic.IEnumerable1, System.Data.CommandType, Boolean) 00000076dbdbd5b0 00007ffd5c51d2fc Kingdee.BOS.App.Data.DBUtils.ExecuteReader(Kingdee.BOS.Context, System.String, System.Data.CommandType, Boolean) 00000076dbdbd5e0 00007ffd5c51d341 Kingdee.BOS.App.Data.DBUtils.ExecuteReader(Kingdee.BOS.Context, System.String) 00000076dbdbd610 00007ffd5ca5a5d4 Kingdee.BOS.App.Core.MainConsole.MainConsoleServer.GetSearchMenuData(Kingdee.BOS.Context, System.String, System.Collections.Generic.HashSet1 ByRef, System.Collections.Generic.HashSet1 ByRef) 00000076dbdbd7d0 00007ffd5ca58164 Kingdee.BOS.App.Core.MainConsole.MainConsoleServer.GetMenuArrayForCache(Kingdee.BOS.Context) 00000076dbdbda78 00007ffdbb4f6793 [DebuggerU2MCatchHandlerFrame: 00000076dbdbda78] 00000076dbdbddb8 00007ffdbb4f6793 [HelperMethodFrame_PROTECTOBJ: 00000076dbdbddb8] System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean) 00000076dbdbdf30 00007ffdb914b690 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[]) [f:\dd\ndp\clr\src\BCL\system\reflection\methodinfo.cs @ 761] 00000076dbdbdfa0 00007ffdb9142922 System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) [f:\dd\ndp\clr\src\BCL\system\reflection\methodinfo.cs @ 735] 00000076dbdbe020 00007ffdb9143f22 System.Reflection.MethodBase.Invoke(System.Object, System.Object[]) [f:\dd\ndp\clr\src\BCL\system\reflection\methodbase.cs @ 211] 00000076dbdbe060 00007ffd5c61990c Microsoft.Practices.Unity.InterceptionExtension.InterceptingRealProxy+c__DisplayClass1.b__0(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextInterceptionBehaviorDelegate) 00000076dbdbe160 00007ffd5c619477 Microsoft.Practices.Unity.InterceptionExtension.PolicyInjectionBehavior+c__DisplayClass1.b__0(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextHandlerDelegate) 00000076dbdbe200 00007ffd5c61cbc4 Kingdee.BOS.Cache.KCacheMethodCallHandler.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextHandlerDelegate) 00000076dbdbe350 00007ffd5c61b10b Kingdee.BOS.Performance.Publisher.PerformanceCallHandler.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextHandlerDelegate) 00000076dbdbe3e0 00007ffd5c61b10b Kingdee.BOS.Performance.Publisher.PerformanceCallHandler.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextHandlerDelegate) 00000076dbdbe470 00007ffd5c61b10b Kingdee.BOS.Performance.Publisher.PerformanceCallHandler.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextHandlerDelegate) 00000076dbdbe500 00007ffd5c61936d Microsoft.Practices.Unity.InterceptionExtension.HandlerPipeline.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.InvokeHandlerDelegate) 00000076dbdbe590 00007ffd5c618999 Microsoft.Practices.Unity.InterceptionExtension.PolicyInjectionBehavior.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextInterceptionBehaviorDelegate) 00000076dbdbe620 00007ffd5c61845d Microsoft.Practices.Unity.InterceptionExtension.InterceptionBehaviorPipeline.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.InvokeInterceptionBehaviorDelegate) 00000076dbdbe6b0 00007ffd5c617002 Microsoft.Practices.Unity.InterceptionExtension.InterceptingRealProxy.Invoke(System.Runtime.Remoting.Messaging.IMessage) 00000076dbdbe790 00007ffdb911190c System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData ByRef, Int32) [f:\dd\ndp\clr\src\BCL\system\runtime\remoting\realproxy.cs @ 823] 00000076dbdbe980 00007ffdbb4f4a02 [TPMethodFrame: 00000076dbdbe980] Kingdee.BOS.Contracts.IMainConsoleServer.GetMenuArrayForCache(Kingdee.BOS.Context) 00000076dbdbec00 00007ffdb91ad436 System.Threading.Tasks.Task.Execute() [f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs @ 2498] 00000076dbdbec40 00007ffdb915ca72 System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) [f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs @ 954] 00000076dbdbed10 00007ffdb915c904 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) [f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs @ 902] 00000076dbdbed40 00007ffdb91ad6dc System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef) [f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs @ 2827] 00000076dbdbedf0 00007ffdb91acdf3 System.Threading.Tasks.Task.ExecuteEntry(Boolean) [f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs @ 2767] 00000076dbdbee30 00007ffdb9194882 System.Threading.ThreadPoolWorkQueue.Dispatch() [f:\dd\ndp\clr\src\BCL\system\threading\threadpool.cs @ 820] 00000076dbdbf2c8 00007ffdbb4f6793 [DebuggerU2MCatchHandlerFrame: 00000076dbdbf2c8] 00000076dbdbf458 00007ffdbb4f6793 [ContextTransitionFrame: 00000076dbdbf458] 00000076dbdbf688 00007ffdbb4f6793 [DebuggerU2MCatchHandlerFrame: 00000076dbdbf688] OS Thread Id: 0x153c (135) Child SP IP Call Site GetFrameContext failed: 1 0000000000000000 0000000000000000 OS Thread Id: 0x242c (136) Child SP IP Call Site GetFrameContext failed: 1 0000000000000000 0000000000000000 OS Thread Id: 0x153c (135) Child SP IP Call Site GetFrameContext failed: 1 0000000000000000 0000000000000000 OS Thread Id: 0x242c (136) Child SP IP Call Site GetFrameContext failed: 1 0000000000000000 0000000000000000 OS Thread Id: 0x2a04 (137) Child SP IP Call Site 00000076dbf7af08 00007ffdca2e6124 [InlinedCallFrame: 00000076dbf7af08] .SNIReadSyncOverAsync(SNI_ConnWrapper*, SNI_Packet**, Int32) 00000076dbf7af08 00007ffdaaaf5dd4 [InlinedCallFrame: 00000076dbf7af08] .SNIReadSyncOverAsync(SNI_ConnWrapper*, SNI_Packet**, Int32) 00000076dbf7aee0 00007ffdaaaf5dd4 DomainNeutralILStubClass.IL_STUB_PInvoke(SNI_ConnWrapper*, SNI_Packet**, Int32) 00000076dbf7af90 00007ffdaab08fe3 SNINativeMethodWrapper.SNIReadSyncOverAsync(System.Runtime.InteropServices.SafeHandle, IntPtr ByRef, Int32) 00000076dbf7aff0 00007ffdaabe0ae0 System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync() 00000076dbf7b050 00007ffdaabe09dd System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket() 00000076dbf7b090 00007ffdaabdf7f5 System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer() 00000076dbf7b0d0 00007ffdaabdfa0e System.Data.SqlClient.TdsParserStateObject.TryReadByte(Byte ByRef) 00000076dbf7b110 00007ffdaabc7daa System.Data.SqlClient.TdsParser.TryRun(System.Data.SqlClient.RunBehavior, System.Data.SqlClient.SqlCommand, System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.BulkCopySimpleResultSet, System.Data.SqlClient.TdsParserStateObject, Boolean ByRef) 00000076dbf7b270 00007ffdaabbb3c7 System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() 00000076dbf7b2d0 00007ffdaabb8325 System.Data.SqlClient.SqlDataReader.get_MetaData() 00000076dbf7b320 00007ffdaab3be73 System.Data.SqlClient.SqlCommand.FinishExecuteReader(System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.RunBehavior, System.String, Boolean, Boolean) 00000076dbf7b390 00007ffdaab3b75f System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, Boolean, Int32, System.Threading.Tasks.Task ByRef, Boolean, Boolean, System.Data.SqlClient.SqlDataReader, Boolean) 00000076dbf7b470 00007ffdaab3a763 System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, System.String, System.Threading.Tasks.TaskCompletionSource1, Int32, System.Threading.Tasks.Task ByRef, Boolean ByRef, Boolean, Boolean)
00000076dbf7b540 00007ffdaab3a49b System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, System.String)
00000076dbf7b5e0 00007ffdaab35cc6 System.Data.SqlClient.SqlCommand.ExecuteReader(System.Data.CommandBehavior, System.String)
00000076dbf7b670 00007ffd5c517ead Kingdee.BOS.App.Data.AbstractDatabase.DoExecuteReader(System.Data.Common.DbCommand, System.Data.CommandBehavior)
00000076dbf7b6d0 00007ffd5c515ebb Kingdee.BOS.App.Data.AbstractDatabase.ExecuteReader(System.Data.Common.DbCommand, System.Collections.Generic.IEnumerable1, System.Data.CommandBehavior, Boolean) 00000076dbf7b750 00007ffd5c4fd6f2 Kingdee.BOS.App.Data.AbstractDatabase.ExecuteReader(System.Data.Common.DbCommand, System.Collections.Generic.IEnumerable1, System.Data.CommandBehavior)
00000076dbf7b780 00007ffd5c4e31b1 Kingdee.BOS.App.Data.DBUtils.ExecuteReader(Kingdee.BOS.Context, System.String, System.Collections.Generic.IEnumerable1, System.Data.CommandType, System.Data.CommandBehavior, Boolean) 00000076dbf7b7f0 00007ffd5c51d2a7 Kingdee.BOS.App.Data.DBUtils.ExecuteReader(Kingdee.BOS.Context, System.String, System.Collections.Generic.IEnumerable1, System.Data.CommandType, Boolean)
00000076dbf7b830 00007ffd5c61737a Kingdee.BOS.App.Data.DBUtils.ExecuteReader(Kingdee.BOS.Context, System.String, System.Collections.Generic.List`1)
00000076dbf7b860 00007ffd5c8d2bd7 Kingdee.BOS.App.Core.UserParameterService.GetParamter(Kingdee.BOS.Context, Int64, System.String, System.String)
00000076dbf7bb68 00007ffdbb4f6793 [DebuggerU2MCatchHandlerFrame: 00000076dbf7bb68]
00000076dbf7bea8 00007ffdbb4f6793 [HelperMethodFrame_PROTECTOBJ: 00000076dbf7bea8] System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
00000076dbf7c020 00007ffdb914b690 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[]) [f:\dd\ndp\clr\src\BCL\system\reflection\methodinfo.cs @ 761]
00000076dbf7c090 00007ffdb9142922 System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) [f:\dd\ndp\clr\src\BCL\system\reflection\methodinfo.cs @ 735]
00000076dbf7c110 00007ffdb9143f22 System.Reflection.MethodBase.Invoke(System.Object, System.Object[]) [f:\dd\ndp\clr\src\BCL\system\reflection\methodbase.cs @ 211]
00000076dbf7c150 00007ffd5c61990c Microsoft.Practices.Unity.InterceptionExtension.InterceptingRealProxy+c__DisplayClass1.b__0(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextInterceptionBehaviorDelegate)
00000076dbf7c250 00007ffd5c619477 Microsoft.Practices.Unity.InterceptionExtension.PolicyInjectionBehavior+c__DisplayClass1.b__0(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextHandlerDelegate)
00000076dbf7c2f0 00007ffd5c61cbc4 Kingdee.BOS.Cache.KCacheMethodCallHandler.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextHandlerDelegate)
00000076dbf7c440 00007ffd5c61b10b Kingdee.BOS.Performance.Publisher.PerformanceCallHandler.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextHandlerDelegate)
00000076dbf7c4d0 00007ffd5c61b10b Kingdee.BOS.Performance.Publisher.PerformanceCallHandler.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextHandlerDelegate)
00000076dbf7c560 00007ffd5c61b10b Kingdee.BOS.Performance.Publisher.PerformanceCallHandler.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextHandlerDelegate)
00000076dbf7c5f0 00007ffd5c61936d Microsoft.Practices.Unity.InterceptionExtension.HandlerPipeline.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.InvokeHandlerDelegate)
00000076dbf7c680 00007ffd5c618999 Microsoft.Practices.Unity.InterceptionExtension.PolicyInjectionBehavior.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.GetNextInterceptionBehaviorDelegate)
00000076dbf7c710 00007ffd5c61845d Microsoft.Practices.Unity.InterceptionExtension.InterceptionBehaviorPipeline.Invoke(Microsoft.Practices.Unity.InterceptionExtension.IMethodInvocation, Microsoft.Practices.Unity.InterceptionExtension.InvokeInterceptionBehaviorDelegate)
00000076dbf7c7a0 00007ffd5c617002 Microsoft.Practices.Unity.InterceptionExtension.InterceptingRealProxy.Invoke(System.Runtime.Remoting.Messaging.IMessage)
00000076dbf7c880 00007ffdb911190c System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData ByRef, Int32) [f:\dd\ndp\clr\src\BCL\system\runtime\remoting\realproxy.cs @ 823]
00000076dbf7ca70 00007ffdbb4f4a02 [TPMethodFrame: 00000076dbf7ca70] Kingdee.BOS.Contracts.IUserParameterService.GetParamter(Kingdee.BOS.Context, Int64, System.String, System.String)
00000076dbf7ccf0 00007ffd5c8d28c5 Kingdee.BOS.App.Security.K3CloudLoginService.SetRegionInfo(Kingdee.BOS.Context, Kingdee.BOS.Contracts.IUserParameterService, Kingdee.BOS.Orm.DataEntity.DynamicObject)
00000076dbf7cd70 00007ffd5c22b2e2 Kingdee.BOS.App.Security.K3DataCenterService.GetDataCenterContextByID(System.String)
00000076dbf7cdc0 00007ffd5c227d97 Kingdee.BOS.App.Security.K3CloudLoginService+c__DisplayClass8.b__3(System.String)
00000076dbf7cdf0 00007ffd5c228471 Kingdee.BOS.Core.Authentication.AbstractAuthService.LoadContext(Kingdee.BOS.Core.Authentication.LoadContextArg)
00000076dbf7ce50 00007ffd5c226ed8 Kingdee.BOS.App.Security.K3CloudLoginService.Login(Kingdee.BOS.Performance.Common.PerformanceContext, Kingdee.BOS.Authentication.LoginInfo)
00000076dbf7ced0 00007ffd5c20b5a9 Kingdee.BOS.ServiceHelper.LoginServiceHelper.Login(Kingdee.BOS.Performance.Common.PerformanceContext, System.String, Kingdee.BOS.Authentication.LoginInfo)
00000076dbf7cf30 00007ffd5c20960f Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateLoginInfo(System.String, Kingdee.BOS.Authentication.LoginInfo)
00000076dbf7d080 00007ffd5c20783c Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser(System.String, System.String, System.String, Int32)
00000076dbf7d318 00007ffdbb4f6793 [DebuggerU2MCatchHandlerFrame: 00000076dbf7d318]
00000076dbf7d658 00007ffdbb4f6793 [HelperMethodFrame_PROTECTOBJ: 00000076dbf7d658] System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Object[], System.Signature, Boolean)
00000076dbf7d7d0 00007ffdb914b690 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object, System.Object[], System.Object[]) [f:\dd\ndp\clr\src\BCL\system\reflection\methodinfo.cs @ 761]
00000076dbf7d840 00007ffdb9142922 System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo) [f:\dd\ndp\clr\src\BCL\system\reflection\methodinfo.cs @ 735]
00000076dbf7d8c0 00007ffd5c206201 Kingdee.BOS.ServiceFacade.KDServiceFx.ServiceExecutor.Execute(Kingdee.BOS.ServiceFacade.KDServiceFx.KDServiceContext, Kingdee.BOS.ServiceFacade.KDServiceFx.ServiceType, System.String[], Kingdee.BOS.ServiceFacade.SerializerProxy, Kingdee.BOS.ServiceFacade.KDServiceFx.ServiceType)
00000076dbf7d960 00007ffd5c203ea9 Kingdee.BOS.ServiceFacade.KDServiceFx.ExecuteServiceModule.OnProcess(Kingdee.BOS.ServiceFacade.KDServiceFx.KDServiceContext)
00000076dbf7da00 00007ffd5c203ab8 Kingdee.BOS.ServiceFacade.KDServiceFx.ModulePipeline.ExcuteRequest(Kingdee.BOS.ServiceFacade.KDServiceFx.KDServiceContext)
00000076dbf7da50 00007ffd5c20123e Kingdee.BOS.ServiceFacade.KDServiceFx.RequestExcuteRuntime.StartRequest(Kingdee.BOS.ServiceFacade.KDServiceFx.RequestExtractor, Kingdee.BOS.ServiceFacade.KDServiceFx.WebContext)
00000076dbf7daa0 00007ffd5c200f00 Kingdee.BOS.ServiceFacade.KDServiceFx.KDSVCHandler.ExecuteRequest(Kingdee.BOS.ServiceFacade.KDServiceFx.WebContext, Kingdee.BOS.ServiceFacade.KDServiceFx.RequestExtractor)
00000076dbf7dae0 00007ffd5c200d45 Kingdee.BOS.ServiceFacade.KDServiceFx.KDSVCHandler.ProcessRequestInternal(Kingdee.BOS.ServiceFacade.KDServiceFx.WebContext, Kingdee.BOS.ServiceFacade.KDServiceFx.RequestExtractor)
00000076dbf7db30 00007ffdac1a373e *** WARNING: Unable to verify checksum for System.Web.ni.dll
System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
00000076dbf7dbc0 00007ffdac1633fb System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)
00000076dbf7dc10 00007ffdac178220 System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)
00000076dbf7dd70 00007ffdac163f79 System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback)
00000076dbf7ddc0 00007ffdac1766c3 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)
00000076dbf7de40 00007ffdac165398 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
00000076dbf7e000 00007ffdac164f63 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
00000076dbf7e040 00007ffdac8646ba DomainNeutralILStubClass.IL_STUB_ReversePInvoke(Int64, Int64, Int64, Int32)
00000076dbf7e8b0 00007ffdbb4f21fe [InlinedCallFrame: 00000076dbf7e8b0] System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatus ByRef)
00000076dbf7e8b0 00007ffdac1d2dde [InlinedCallFrame: 00000076dbf7e8b0] System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatus ByRef)
00000076dbf7e880 00007ffdac1d2dde DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, System.Web.RequestNotificationStatus ByRef)
00000076dbf7e940 00007ffdac16556f System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
00000076dbf7eb00 00007ffdac164f63 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
00000076dbf7eb40 00007ffdac8646ba DomainNeutralILStubClass.IL_STUB_ReversePInvoke(Int64, Int64, Int64, Int32)
00000076dbf7ed18 00007ffdbb4f2453 [ContextTransitionFrame: 00000076dbf7ed18]
通过仔细比对发现这么一条Kingdee.BOS.App.Core.MainConsole.MainConsoleServer.GetMenuArrayForCache(Kingdee.BOS.Context)调用堆栈。从方法命名来看,像是用来获取菜单数组并缓存。结合前后堆栈的联系,我们可以大致得出这样一个线索:用户使用WebApi登录后会缓存一份独立的菜单供用户使用。

有了代码堆栈,接下来知道怎么干了吧?当然是核实源代码确定问题啊。

  1. 分析源码验证问题
    Kingdee.BOS.App.Core.MainConsole.MainConsoleServer.GetMenuArrayForCache(Kingdee.BOS.Context)方法源代码如下:
    GetMenuArrayForCache

我们发现它是用的UserToken来缓存用户菜单。看到Token,你可能就会条件反射的想到其生命周期。是的,聪明贤惠如你,Token是有生命周期的。也就意味着Token过期后,下次登录还会再次缓存一份菜单。你可能会问Token过期后没有去清对应的菜单缓存吗?是的,并没有。

严谨的你,可能又会问Token多久过期?20mins。你眼珠子一转,接着问,满打满算,一个用户1个小时也就申请3次Token,24小时,也就申请72个Token,一个菜单缓存也就顶多1K,所以一个用户一天也就最多占用72K。你的网站得有多少并发,才能被这么多菜单缓存撑爆啊?!

Good Question!!!

是的,客户的应用场景的并发也就顶多几百而已。那到底是什么导致如此多的菜单缓存呢?

原因是,客户的第三方客户端使用WebApi与我们的系统对接。而每次调用WebApi时都会先去调用登录接口,但却未保存会话信息。也就是说,客户第三方客户端每次的WebApi调用都会产生一个新的Token。那如果有成千上万的WebApi请求,也就意味着成千上万的菜单缓存啊。

好了,点到为止。至此,已经基本定位到问题的根源了。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Windbg分析高内存占用问题 的相关文章

  • 使用Python将图像转换为十六进制格式

    我的下面有一个jpg文件tmp folder upload path tmp resized test jpg 我一直在使用下面的代码 Method 1 with open upload path rb as image file enco
  • 是否有最新的 Facebook Java SDK? [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 好像没找到最近更新的 如果没有 是否有一个好的 Java 库来执行与 Facebook 的 API 交
  • Android 解析 JSON 卡在 get 任务上

    我正在尝试解析一些 JSON 数据 我的代码工作了一段时间 我不确定我改变了什么突然破坏了代码 当我运行代码时 我没有收到任何运行时错误或警告 我创建一个新的 AsyncTask 并执行它 当我打电话时 get 在这个新任务中 调试器在此行
  • 从命令行启用/禁用 Windows 10 中的设备 [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我有一个特定的硬件 我想在每次 Windows 重新启动时禁用并重新启用它 我创建了一个批处理脚本 该脚本应该执行此操作 然后运行我的程序
  • 字典的嵌套列表

    我正在尝试创建dict通过嵌套list groups Group1 A B Group2 C D L y x 0 for y in x if y x 0 for x in groups d k v for d in L for k v in
  • 使用循环将对象添加到列表(python)

    我正在尝试使用 while 循环将对象添加到列表中 基本上这就是我想做的 class x pass choice raw input pick what you want to do while choice 0 if choice 1 E
  • 使用 HTTPServletRequestWrapper 包装请求参数

    我有一个可以验证 授权 REST 调用的过滤器 该过滤器需要访问请求参数 因此我为此编写了一个自定义 HTTPServletRequestWrapper import java util Collections import java ut
  • java swing:向 JTree 项目添加自定义图形按钮

    我想在 JTree 中的项目右侧添加一个带有小图标的附加按钮 这可以做到吗 如果是这样 怎么办 thanks Clamp 你在这方面成功了吗 我想做同样的事情 但很难让 JButton 响应用户 设置渲染器以显示按钮的过程很顺利 但所有鼠标
  • 在 pip.conf 中指定多个可信主机

    这是我尝试在我的中设置的 etc pip conf global trusted host pypi org files pythonhosted org 但是 它无法正常工作 参考 https pip pypa io en stable
  • python中的sys.stdin.fileno()是什么

    如果这是非常基本的或之前已经问过的 我很抱歉 我用谷歌搜索但找不到简单且令人满意的解释 我想知道什么sys stdin fileno is 我在代码中看到了它 但不明白它的作用 这是实际的代码块 fileno sys stdin filen
  • Python 矩阵每一行的总和

    lista 1 2 3 4 5 6 7 8 9 print lista def filas lista res for elemento in lista x sum lista elemento res append x print re
  • 使用 lambda 函数更改属性值

    我可以使用 lambda 函数循环遍历类对象列表并更改属性值 对于所有对象或满足特定条件的对象 吗 class Student object def init self name age self name name self age ag
  • 是否可以写一个负的python类型注释

    这可能听起来不合理 但现在我需要否定类型注释 我的意思是这样的 an int Not Iterable a string Iterable 这是因为我为一个函数编写了一个重载 而 mypy 不理解我 我的功能看起来像这样 overload
  • android 中的 java.net.URL ..新手问题

    我是java新手 正在尝试android开发 以下代码生成 malformedURLException 有人可以帮助我识别异常吗 任何提示都会非常有帮助 package com example helloandroid import and
  • 如何将库添加到 LIBGDX 项目的依赖项 gradle

    一切都在问题中 我已经尝试了在 SO 和其他网站中找到的所有答案 但没有运气 这就是我迄今为止尝试过的 adding compile fileTree dir lib include jar 到我的 build gradle adding
  • 从 dask 数据框中的日期时间序列获取年份和星期?

    如果我有一个 Pandas 数据框和一个日期时间类型的列 我可以按如下方式获取年份 df year df date dt year 对于 dask 数据框 这是行不通的 如果我先计算 像这样 df year df date compute
  • 如何对字符串列表进行排序?

    在 Python 中创建按字母顺序排序的列表的最佳方法是什么 基本回答 mylist b C A mylist sort 这会修改您的原始列表 即就地排序 要获取列表的排序副本而不更改原始列表 请使用sorted http docs pyt
  • 使用自定义比较器在 Java 中创建 SortedMap

    我想创建一个TreeMap在 Java 中具有自定义排序顺序 排序后的键是字符串 需要根据第二个字符进行排序 这些值也是字符串 示例地图 Za FOO Ab Bar 您可以像这样使用自定义比较器 Comparator
  • 如何使用 Django (Python) 登录表单?

    我在 Django 中构建了一个登录表单 现在我遇到了路由问题 当我选择登录按钮时 表单不会发送正确的遮阳篷 我认为前端的表单无法从 查看 py 文件 所以它不会发送任何 awnser 并且登录过程无法工作 该表单是一个简单的静态 html
  • java.lang.ClassCastException:com.sun.proxy.$Proxy8 无法转换为 org.openqa.selenium.internal.WrapsDriver

    我有以下切入点和 AspectJ 中给出的建议 Pointcut call org openqa selenium WebElement sendKeys public void onWebElementAction After onWeb

随机推荐

  • 日期加年,返回年份

    日期加年 返回字符串 param date str yyyy mm dd 必须是这个格式 param year 加的年 return string 年份 static function dateAddYear date str year i
  • 数据库连接异常:create connection error, url: jdbc:mysql://ip/数据库名, errorCode 0, state 08S01问题处理

    今天项目中新增了一部分接口 本地测试好之后打包部署到测试环境 数据库竟然连接失败 报错信息如下 create connection error url jdbc mysql ip 数据库名 errorCode 0 state 08S01 这
  • solidworks齿轮编辑_如何应用solidworks进行齿轮工程图绘制

    引言 齿轮是一种常用的传动零件 也是机械设计过程中经常需要设计的一种零件 由于齿轮的工程图绘制与一般零件有较大区别 在利用一般的三维软件设计出三维图形后并不能马上得到准确的二维图形 这种情况会大大降低工程技术人员的设计速度 增加设计成本 S
  • 安卓数据线ssh连树莓派(超简单)

    无需联网 无需无限网卡 树莓派 sudo vim etc network interfaces 添加或修改这句iface usb0 inet dhcp 然后手机数据线插上树莓派 开启usb网络共享 用better terminal或者ter
  • 记录一个std::future和std::async的demo

    Demo和代码简述 子线程函数 参数a传进去模拟遇到的带参数问题 函数的返回值可以是处理完的任意值 若有返回值则get 到的就是返回值 比如这个demo里get到的就是3 int TestNoClass int a int main int
  • LFSR

    c语言中实现LFSR define CRT SECURE NO WARNINGS include
  • 同步式SPWM两电平正弦脉宽调制逆变器(全波三角波)——正弦波为调制波(双重傅里叶分析)

    SPWM正弦脉宽调制介绍 SPWM是调制波为正弦波 载波为三角波或锯齿波的一种脉宽调制法 特点 原理简单 通用性强 控制和调节性能好 具有先出谐波 调节和稳定输出电压的多种作用 是一种比较好的波形改善法 分类 分为两阶式和三阶式两种 阶 指
  • S3C2440读写sd卡的一些总结

    整理硬盘的时候发现这个文档 以前写2440操作sd卡程序的时候总结的 1 我的2440 sdi对sd卡发送ACMD41时总是反馈crc fail 但是可以得到正确的response sd卡可以正常使用 2 sd卡可以没有mbr 在物理的 0
  • 推理规则的具体应用

    小伙伴们 大家好呀 相信步入大二的同学们肯定会学到离散数学 而推理规则是离散数学中最fundmental and important 的知识体系 今天我们来说说基本的推理规则 Firstly 推理 inference rules 是 前提
  • hibernate--lazy(懒加载)属性

    关联映射文件中
  • 线性表之单链表

    include stdafx h include
  • WebRTC学习(二)Windows10平台WebRTC编译(VS2017)

    1 Visual Studio 2017安装 WebRTC用到了很多C 最新特性 所以编译最新WebRTC代码VS要求为2017 gt 15 7 2 版本 2 安装SDK调试工具 由于最新WebRTC源码要求10 0 18362及以上Win
  • wordpress线上部署&更新主题

    目录 新增主题 主题介绍 部署到线上 更新主题 新增主题 随便复制一个主题到test文件夹 test主题文件cnpm I npm i 失败的可以使用淘宝镜像 cpm i 热更新 主题介绍 test目录下的style css Theme Na
  • 论文笔记:LightGCL: Simple Yet Effective Graph Contrastive Learning for Recommendation

    ICLR 2023 1 intro GNN在基于图的推荐系统中展现了良好的效果 这得益于其整合相邻结点信息以进行协同过滤的能力 在用户 物品交互图上进行多层的信息传递 以此挖掘高阶的连接信息 很大一部分基于 GNN 的协同过滤模型采用了监督
  • vue跨域处理(vue项目中baseUrl设置问题)

    一 方法一 在公用文件common js中设置baseUrl export var baseUrl process env NODE ENV production window g ApiUrl api 该方法的优点 在项目打包时 stat
  • jvm关闭

    关闭方式 正常关闭 最后一个普通线程 非守护线程 结束 调用了System exit 发送SIGINT信号 相当于不带参数的kill命令 或者键入Ctrl C 强制关闭 调用Runtime halt 发送SIGKILL信号 kill 9 命
  • 认证鉴权与API权限控制在微服务架构中的设计与实现(一)

    引言 本文系 认证鉴权与API权限控制在微服务架构中的设计与实现 系列的第一篇 本系列预计四篇文章讲解微服务下的认证鉴权与API权限控制的实现 1 背景 最近在做权限相关服务的开发 在系统微服务化后 原有的单体应用是基于Session的安全
  • JavaScript中的backgroundPosition的设置

    在CSS中background position有对值的设置有两种 一是用数值 绝对的 另一个使用百分比 相对的 这两种方式会有不同的浏览器兼容问题 主要是IE和FF 基本代码如下 style overflow y scroll heigh
  • 从RPA+AI到IPA,RPA是如何进化的?

    随着RPA 机器人流程自动化 的深入发展 如今对于该技术今后的走向业内也形成了共识 那就是RPA不能 独行 一定要加个 伴儿 至于加 谁 则见仁见智 比较常见的则是加AI 人工智能 RPA AI 其实并不是件新鲜事 我们将时间拨回到5年前
  • Windbg分析高内存占用问题

    打Dump 远程客户应用服务器 32G内存占用已经消耗了78 而现场已经反馈收银系统接近奔溃了 要求先强制回收内存 反正也要奔溃了 先打Dump再说吧 PS 打Dump会挂起进程 导致应用无法响应 而打Dump的耗时 也是根据当时进程的内存