SharePoint 2007中的OutOfMemory和内存碎片32位

时间:2012-02-09 17:12:30

标签: sharepoint sharepoint-2007 out-of-memory 32-bit memory-fragmentation

几周以来,我在SharePoint 2007(已发布的内部网,包含许多自定义项)WFE(SP 2和Win 2003 32位服务器)上遇到OutOfMemory问题。在我收到崩溃的内存转储后,我发现我们有内存碎片问题。对于转储分析,我使用以下两个工具:DiagDebug和Windbg with sos.dll。

结果:96,74%可用内存碎片

DebugDiag(记忆压力分析仪)

    Virtual Memory Summary
    Size of largest free VM block   23,63 MBytes 
    Free memory fragmentation   96,74% 
    Free Memory   725,52 MBytes   (35,43% of Total Memory) 
    Reserved Memory   406,88 MBytes   (19,87% of Total Memory) 
    Committed Memory   915,54 MBytes   (44,71% of Total Memory) 
    Total Memory   2,00 GBytes 
    Largest free block at   0x00000000`4b0b0000 

DebugDiag(SharePoint分析程序)

    Undisposed SPRequest objects: 9
    Disposed SPRequest objects: 187
    Undisposed SPWeb objects: 185
    Disposed SPWeb objects: 34
    Undisposed SPSite objects: 8
    Disposed SPSite objects: 22
    undisposed special purpose (AllowCleanupWhenThreadEnds = false) SPRequest object found at: 0x02320dd0.
    undisposed special purpose (AllowCleanupWhenThreadEnds = false) SPRequest object found at: 0x4e8296f8.
    undisposed special purpose (AllowCleanupWhenThreadEnds = false) SPRequest object found at: 0x4e869a20.
    undisposed SPWeb object 0x02701168 references a disposed or invalid SPRequest object: 0x0270137c
    undisposed SPWeb object 0x027013cc references a disposed or invalid SPRequest object: 0x027015e0
    undisposed SPWeb object 0x02720824 references a disposed or invalid SPRequest object: 0x02720a20
    undisposed SPWeb object 0x02d2aa74 references a disposed or invalid SPRequest object: 0x02d2ac70
   ...

    Undisposed SPRequest Objects per managed Thread:
    Thread ID: 6714, Undisposed SPRequest: 4
    Thread ID: 4c68, Undisposed SPRequest: 3
    Thread ID: 5e8c, Undisposed SPRequest: 1
    Thread ID: 6180, Undisposed SPRequest: 1

所以现在我想了解导致内存碎片的原因。希望您能够帮助我。这些是我为获取正确信息所采取的步骤。

带有sos.dll的Windbg

!地址摘要

-------------------- Usage SUMMARY --------------------------
TotSize (      KB)   Pct(Tots) Pct(Busy)   Usage
2c748000 (  728352) : 34.73%    53.79%    : RegionUsageIsVAD
2d584000 (  742928) : 35.43%    00.00%    : RegionUsageFree
f987000 (  255516) : 12.18%    18.87%    : RegionUsageImage
10fc000 (   17392) : 00.83%    01.28%    : RegionUsageStack
  44000 (     272) : 00.01%    00.02%    : RegionUsageTeb
1585a000 (  352616) : 16.81%    26.04%    : RegionUsageHeap
      0 (       0) : 00.00%    00.00%    : RegionUsagePageHeap
   1000 (       4) : 00.00%    00.00%    : RegionUsagePeb
   1000 (       4) : 00.00%    00.00%    : RegionUsageProcessParametrs
   1000 (       4) : 00.00%    00.00%    : RegionUsageEnvironmentBlock
   Tot: 7fff0000 (2097088 KB) Busy: 52a6c000 (1354160 KB)

-------------------- Type SUMMARY --------------------------
TotSize (      KB)   Pct(Tots)  Usage
2d584000 (  742928) : 35.43%   : <free>
154e3000 (  349068) : 16.65%   : MEM_IMAGE
127c000 (   18928) : 00.90%   : MEM_MAPPED
3c30d000 (  986164) : 47.03%   : MEM_PRIVATE

-------------------- State SUMMARY --------------------------
TotSize (      KB)   Pct(Tots)  Usage
3938b000 (  937516) : 44.71%   : MEM_COMMIT
2d584000 (  742928) : 35.43%   : MEM_FREE
196e1000 (  416644) : 19.87%   : MEM_RESERVE

Largest free region: Base 4b0b0000 - Size 017a0000 (24192 KB)

似乎总体上有足够的可用内存(742928 KB),但最大的空闲块只有24192 KB。再次:免费内存碎片!

!线程

ThreadCount: 38
UnstartedThread: 0
BackgroundThread: 37
PendingThread: 0
DeadThread: 0
Hosted Runtime: no
                                  PreEmptive   GC Alloc           Lock
   ID OSID ThreadOBJ    State     GC       Context       Domain   Count APT Exception
14    1 5358 0010f718   1808220 Enabled  00000000:00000000 000dd1b8     0 MTA (Threadpool Worker)
18    2 61a4 001118d0      b220 Enabled  00000000:00000000 000dd1b8     0 MTA (Finalizer)
19    3 6060 0012a3f8    80a220 Enabled  00000000:00000000 000dd1b8     0 MTA (Threadpool Completion Port)
20    4 64c8 0012df90      1220 Enabled  00000000:00000000 000dd1b8     0 Ukn
12    5 57f4 00147e80   880a220 Enabled  00000000:00000000 000dd1b8     0 MTA (Threadpool Completion Port)
23    7 6714 0eb89f08   180b220 Enabled  00000000:00000000 0012e6d0     1 MTA (Threadpool Worker)
24    8 66b8 0eb91970   180b220 Enabled  00000000:00000000 000dd1b8     0 MTA (Threadpool Worker)
25    b 6320 0eb942f0   180b220 Disabled 00000000:00000000 0012e6d0     0 MTA (Threadpool Worker)
26    d 2004 0eb97120   180b220 Enabled  00000000:00000000 000dd1b8     0 MTA (Threadpool Worker)
27    e 5bb0 0eb9a438   180b220 Enabled  00000000:00000000 000dd1b8     0 MTA (Threadpool Worker)
28    f 61a8 0eb9dee8   380b220 Enabled  00000000:00000000 0012e6d0     1 MTA (Threadpool Worker)
29   14 3b88 0ebba688   180b220 Enabled  00000000:00000000 000dd1b8     0 MTA (Threadpool Worker)
30   15 5d74 0ebc4840   380b220 Enabled  00000000:00000000 0012e6d0     1 MTA (Threadpool Worker)
31   16 422c 0ebc91b0   180b220 Enabled  00000000:00000000 000dd1b8     0 MTA (Threadpool Worker)
32   18 6544 125242c8   180b220 Enabled  00000000:00000000 000dd1b8     0 MTA (Threadpool Worker)
33   1a 4c68 12534bc8   180b220 Disabled 4e875ac4:4e875d30 0012e6d0     1 MTA (Threadpool Worker)
34   1b 66d4 12539c80   180b220 Enabled  00000000:00000000 000dd1b8     0 MTA (Threadpool Worker)
35   1c 5e8c 12542e58   180b220 Enabled  00000000:00000000 0012e6d0     1 MTA (Threadpool Worker)
36   1d 62f0 1254be90   180b220 Enabled  4e875d84:4e877d30 0012e6d0     2 MTA (Threadpool Worker) System.OutOfMemoryException (4e875d3c)
39   1e 6558 0ec16d28    80a220 Enabled  00000000:00000000 000dd1b8     0 MTA (Threadpool Completion Port)
40   1f 6180 0ec14b70   200b020 Enabled  00000000:00000000 0012e6d0     0 MTA
43   20 592c 0ebd7a00       220 Enabled  00000000:00000000 000dd1b8     0 MTA
45   21 624c 1261a060       220 Enabled  00000000:00000000 000dd1b8     0 MTA
8   22 5c78 125499f8       220 Enabled  00000000:00000000 000dd1b8     0 Ukn
6   23 3c68 126b6e90       220 Enabled  00000000:00000000 000dd1b8     0 Ukn
7   24 6458 36414400       220 Enabled  00000000:00000000 000dd1b8     0 Ukn
44   25 5e60 36675440       220 Enabled  00000000:00000000 000dd1b8     0 MTA
5   26 55d8 364214a0       220 Enabled  00000000:00000000 000dd1b8     0 Ukn
57   27 6534 36622948       220 Enabled  00000000:00000000 000dd1b8     0 Ukn
58   28 59bc 0016f810       220 Enabled  00000000:00000000 000dd1b8     0 Ukn
56   29 3ee0 250fa6d8       220 Enabled  00000000:00000000 000dd1b8     0 Ukn
60   2a 63fc 252da068   200b220 Enabled  00000000:00000000 0012e6d0     0 MTA
59   2b 5fdc 24fc0be8       220 Enabled  00000000:00000000 000dd1b8     0 Ukn
61   2c 4154 25052008       220 Enabled  00000000:00000000 000dd1b8     0 Ukn
62   2d 60fc 250093a8       220 Enabled  00000000:00000000 000dd1b8     0 Ukn
42   2e 1a38 1c99b5d0       220 Enabled  00000000:00000000 000dd1b8     0 MTA
63   13 59e0 0ebb5d48       220 Enabled  00000000:00000000 000dd1b8     0 Ukn
64   19 6420 0ebac6a0   880b220 Enabled  00000000:00000000 000dd1b8     0 MTA     (Threadpool Completion Port)

!eeheap -gc

Number of GC Heaps: 2
------------------------------
Heap 0 (000e2418)
generation 0 starts at 0x432d0c54
generation 1 starts at 0x432c0038
generation 2 starts at 0x02060038
ephemeral segment allocation context: none
segment    begin allocated     size
02060000 02060038  03d0234c 0x01ca2314(30024468)
432c0000 432c0038  441e82f4 0x00f282bc(15893180)
Large object heap starts at 0x0a060038
segment    begin allocated     size
0a060000 0a060038  0bd57530 0x01cf74f8(30373112)
5b920000 5b920038  5c9bf338 0x0109f300(17429248)
Heap Size  0x5960dc8(93720008)
 ------------------------------
Heap 1 (00110750)
generation 0 starts at 0x4e869d30
generation 1 starts at 0x4e820038
generation 2 starts at 0x06060038
ephemeral segment allocation context: none
segment    begin allocated     size
06060000 06060038  07a0af98 0x019aaf60(26914656)
4e820000 4e820038  4e8eaf38 0x000caf00(831232)
Large object heap starts at 0x0c060038
segment    begin allocated     size
0c060000 0c060038  0c9ec998 0x0098c960(10013024)
6e020000 6e020038  6f90f0a8 0x018ef070(26144880)
Heap Size  0x3cf1830(63903792)
------------------------------
GC Heap Size  0x96525f8(157623800)

!dumpheap(heap1 extract)

  • 0a060038 000e1a98 16免费
  • 0a060048 793042f4 4096
  • 0a061048 000e1a98 16免费
  • 0a061058 793042f4 528
  • 0a061268 000e1a98 16免费
  • 0a061278 793042f4 4096
  • 0a062278 000e1a98 16免费
  • 0a062288 793042f4 5112
  • 0a063680 000e1a98 16免费
  • 0a063690 793042f4 4096
  • 0a064690 000e1a98 16免费
  • 0a0646a0 793042f4 4096
  • 0a0656a0 000e1a98 16免费
  • 0a0656b0 793042f4 5112
  • 0a066aa8 000e1a98 16免费
  • 0a066ab8 793042f4 4096
  • 0a067ab8 000e1a98 16免费
  • 0a067ac8 793042f4 4096
  • 0a068ac8 000e1a98 16免费
  • 0a068ad8 793042f4 4096
  • 0a069ad8 793042f4 528
  • 0a069ce8 000e1a98 16免费
  • 0a069cf8 793042f4 528
  • 0a069f08 793042f4 528
  • 0a06a118 000e1a98 16免费
  • 0a06a128 793042f4 528
  • 0a06a338 000e1a98 260096免费
  • 0a0a9b38 793042f4 4096
  • 0a0aab38 000e1a98 16免费
  • 0a0aab48 793042f4 5784
  • 0a0ac1e0 000e1a98 16免费
  • 0a0ac1f0 793042f4 4096
  • 0a0ad1f0 000e1a98 16免费
  • 0a0ad200 793042f4 528
  • 0a0ad410 000e1a98 16免费
  • 0a0ad420 793042f4 4096
  • 0a0ae420 000e1a98 16免费
  • 0a0ae430 793042f4 528
  • 0a0ae640 000e1a98 16免费
  • 0a0ae650 793042f4 4096
  • 0a0af650 000e1a98 16免费
  • 0a0af660 793042f4 528
  • 0a0af870 000e1a98 16免费
  • 0a0af880 793042f4 528
  • 0a0afa90 000e1a98 131120免费
  • 0a0cfac0 793042f4 528
  • 0a0cfcd0 000e1a98 16免费
  • 0a0cfce0 793042f4 4096
  • 0a0d0ce0 000e1a98 16免费
  • 0a0d0cf0 793042f4 528
  • 0a0d0f00 000e1a98 16免费
  • 0a0d0f10 793042f4 528
  • 0a0d1120 000e1a98 16免费
  • 0a0d1130 793042f4 528
  • 0a0d1340 000e1a98 16免费
  • 0a0d1350 793042f4 4096
  • 0a0d2350 000e1a98 16免费
  • 0a0d2360 793042f4 5784
  • 0a0d39f8 000e1a98 16免费
  • 0a0d3a08 793042f4 4096
  • 0a0d4a08 000e1a98 348200免费
  • 0a129a30 793042f4 528
  • 0a129c40 000e1a98 16免费
  • 0a129c50 793042f4 528
  • 0a129e60 000e1a98 361224免费
  • 0a182168 793042f4 528
  • 0a182378 000e1a98 16免费
  • 0a182388 793042f4 7016
  • 0a183ef0 000e1a98 16免费
  • 0a183f00 793042f4 7016
  • ...
  • 63859d80 14762 413336 System.Xml.XmlElement
  • 6385a090 12103 435708 System.Xml.XmlName
  • 79332b54 21020 504480 System.Collections.ArrayList
  • 6385798c 32932 658640 System.Xml.NameTable + Entry
  • 6385c76c 35215 704300 System.Xml.XmlAttribute
  • 79331754 505 706416 System.Char []
  • 7932dd5c 12751 714056 System.Reflection.RuntimePropertyInfo
  • 6385a284 36665 733300 System.Xml.XmlText
  • 79332cc0 5530 791644 System.Int32 []
  • 7932fde0 22824 1278144 System.Reflection.RuntimeMethodInfo
  • 79333274 6758 1733808 System.Collections.Hashtable + bucket []
  • 793042f4 54360 5051132 System.Object []
  • 79333594 4772 29304312 System.Byte []
  • 79330b24 225539 ​​33121896 System.String
  • 000e1a98 239 72089072免费
  • 总计711343个对象
  • 大于0.5 MB的碎片块:
  • 地址大小跟随4331b1d8 14.8MB 441e8270 System.Threading.Overlapped

我查看了&#34; Free&#34;之间的一些地址。细分但不幸的是,我无法找到有关该问题的来源的任何信息。

!做0a182388

Name: System.Object[]
MethodTable: 793042f4
EEClass: 790eda64
Size: 7012(0x1b64) bytes
Array: Rank 1, Number of elements 1749, Type CLASS
Element Type: System.Object
Fields:
None

!gcroot 0a182388

Note: Roots found on stacks may be false positives. Run "!help gcroot" for
more info.
Scan Thread 14 OSTHread 5358
Scan Thread 18 OSTHread 61a4
Scan Thread 19 OSTHread 6060
Scan Thread 20 OSTHread 64c8
Scan Thread 12 OSTHread 57f4
Scan Thread 23 OSTHread 6714
Scan Thread 24 OSTHread 66b8
Scan Thread 25 OSTHread 6320
Scan Thread 26 OSTHread 2004
Scan Thread 27 OSTHread 5bb0
Scan Thread 28 OSTHread 61a8
Scan Thread 29 OSTHread 3b88
Scan Thread 30 OSTHread 5d74
Scan Thread 31 OSTHread 422c
Scan Thread 32 OSTHread 6544
Scan Thread 33 OSTHread 4c68
Scan Thread 34 OSTHread 66d4
Scan Thread 35 OSTHread 5e8c
Scan Thread 36 OSTHread 62f0
Scan Thread 39 OSTHread 6558
Scan Thread 40 OSTHread 6180
Scan Thread 43 OSTHread 592c
Scan Thread 45 OSTHread 624c
Scan Thread 8 OSTHread 5c78
Scan Thread 6 OSTHread 3c68
Scan Thread 7 OSTHread 6458
Scan Thread 44 OSTHread 5e60
Scan Thread 5 OSTHread 55d8
Scan Thread 57 OSTHread 6534
Scan Thread 58 OSTHread 59bc
Scan Thread 56 OSTHread 3ee0
Scan Thread 60 OSTHread 63fc
Scan Thread 59 OSTHread 5fdc
Scan Thread 61 OSTHread 4154
Scan Thread 62 OSTHread 60fc
Scan Thread 42 OSTHread 1a38
Scan Thread 63 OSTHread 59e0
Scan Thread 64 OSTHread 6420
DOMAIN(0012E6D0):HANDLE(Pinned):e4613d4:Root:0a182388(System.Object[])

!gcroot 0a129a30      ...      扫描线程64 OSTHread 6420

 DOMAIN(000DD1B8):HANDLE(Pinned):1fc11b8:Root:0a129a30(System.Object[])

!gcroot 0a061278     ...     DOMAIN(000DD1B8):手柄(销接):1fb13f0:根:0a061278(System.Object的[])

!gchandles

GC Handle Statistics:
Strong Handles: 1007
Pinned Handles: 474
Async Pinned Handles: 6
Ref Count Handles: 5
Weak Long Handles: 681
Weak Short Handles: 56
Other Handles: 0
...
661485ec       68         2176 System.Web.NativeFileChangeNotification
66153774       93         2976 System.Web.Hosting.ISAPIAsyncCompletionCallback
793310f8       68         3808 System.Threading.Thread
793141f0      162         6480 System.Reflection.Emit.DynamicResolver
79332070      279         6696 System.Reflection.Assembly
7932f19c      228        10944 System.Reflection.Module
793327e8      328        11808 System.Security.PermissionSet
7932f25c      386        29336 System.RuntimeType+RuntimeTypeCache
793042f4      185       294456 System.Object[]

在DebugDiag SharePoint Analysis中报告了一些未公开的SPWeb对象。 所以试图找到原因...... 报告:&#34;未曝光的SPWeb对象 0x02701168 引用已处置或无效的SPRequest对象: 0x0270137c &#34;

!做0x02701168

Name: Microsoft.SharePoint.SPWeb
MethodTable: 1325ed80
EEClass: 1669cd80
Size: 508(0x1fc) bytes
(C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SharePoint\12.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.dll)

!gcroot 0x02701168

Note: Roots found on stacks may be false positives. Run "!help gcroot" for
more info.
Scan Thread 14 OSTHread 5358
Scan Thread 18 OSTHread 61a4
Scan Thread 19 OSTHread 6060
Scan Thread 20 OSTHread 64c8
Scan Thread 12 OSTHread 57f4
Scan Thread 23 OSTHread 6714
ESP:efbe92c:Root:07a2cbc8(System.Collections.Hashtable+bucket[])->
023f1044(Microsoft.SharePoint.Publishing.CacheManager)->
023f3df4(Microsoft.SharePoint.Publishing.CachedObjectFactory)->
023f3e7c(Microsoft.SharePoint.Publishing.WssObjectCache)->
023f3f30(System.Collections.Hashtable)->
03b0f448(System.Collections.Hashtable+bucket[])->
0733b918(Microsoft.SharePoint.Publishing.ThreadSafeCache`2+CacheEntry`2[[System.String, mscorlib],[Microsoft.SharePoint.Publishing.CachedObjectWrapper, Microsoft.SharePoint.Publishing],[System.String, mscorlib],[Microsoft.SharePoint.Publishing.CachedObjectWrapper, Microsoft.SharePoint.Publishing]])->
0733b868(Microsoft.SharePoint.Publishing.CachedObjectWrapper)->
035f25b4(Microsoft.SharePoint.Publishing.CachedPage)->
035f2718(System.Collections.Generic.Dictionary`2[[Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing],[Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode, Microsoft.SharePoint.Publishing]])->
0733ba90(System.Collections.Generic.Dictionary`2+Entry[[Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing],[Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode, Microsoft.SharePoint.Publishing]][])->
0733b92c(Microsoft.SharePoint.Publishing.Navigation.PortalListItemSiteMapNode)->
069b2f88(Microsoft.SharePoint.Publishing.Navigation.PortalWebSiteMapNode)->
069bfee4(System.Collections.Generic.Dictionary`2[[System.Guid, mscorlib],[Microsoft.SharePoint.Publishing.Navigation.ProxySiteMapNode, Microsoft.SharePoint.Publishing]])->
069d8fe8(System.Collections.Generic.Dictionary`2+Entry[[System.Guid, mscorlib],[Microsoft.SharePoint.Publishing.Navigation.ProxySiteMapNode, Microsoft.SharePoint.Publishing]][])->
069e0934(Microsoft.SharePoint.Publishing.Navigation.ProxySiteMapNode)->
069e04a8(Microsoft.SharePoint.Navigation.SPNavigationNode)->
069bfe28(Microsoft.SharePoint.Navigation.SPNavigation)->
069bf7dc(Microsoft.SharePoint.SPWeb)->
02700dcc(Microsoft.SharePoint.SPSite)->
02701364(System.Collections.Generic.List`1[[Microsoft.SharePoint.SPWeb, Microsoft.SharePoint]])->

MS处理的检查员也没有发现任何问题。

所以现在我不知道如何继续寻找导致内存碎片的(自定义)组件。我希望有人可以给我一些提示,工具建议或检查可能导致碎片的组件列表(防病毒,缓存等)。问题只在产品环境中造成损害,我们现在唯一能做的就是iisreset - 有时候每天5次......

提前感谢您和最好的问候,

安东

1 个答案:

答案 0 :(得分:0)

您的崩溃日志可能包含错误对象,但更有可能正在执行的程序集随着每次崩溃而变化,并且似乎是随机的。他们可能只是一个无辜的旁观者,当所有的记忆消失时,他们仍然拿着书包。

首先 - 您是否无法将应用程序池配置为在达到特定内存阈值时自动回收?这可能有助于减轻您持续监控并为IISRESET做好准备的需求。否则,您可能希望安排定期回收以保持内存整洁。

接下来,尝试确定崩溃何时开始,并检查部署日志以查看已安装的内容。 (你要记录软件包的安装日志吗?)

自定义组件是内部开发的吗?您最初可以通过让开发人员检查所有已使用SharePoint Dispose Checker Tool部署的项目来解决一些工作(这是您在问题末尾所指的那样吗?)未部署的SPWeb和SPSite对象似乎是这种分裂的最大原因。

探索的另一条途径是this MSDN question我在寻找其他东西时遇到了。看来发布页面上的导航栏应该受到指责。该问题有一个修补程序,但您必须直接从Microsoft请求它。

我一直在为SharePoint开发很长一段时间,但找到这些问题始终是别人的工作!这些花絮是我随着时间的推移收集的,希望有用的东西。