Web アプリケーション コードのメモリ リークの可能性

Microsoft.Windows.InternetInformationServices.10.0.ApplicationPool.MemoryLeak.Monitor (UnitMonitor)

このモニターは、構成したメモリのしきい値を超えたためにアプリケーション プールがリサイクルされるときにログに記録されたイベントを調査し、アプリケーション プールのリサイクル頻度がきわめて多い (モニターの設定を基準として) 場合にその状態を警告に変更します。これは手動リセット モニターで、正常な状態に自動的に切り替わることはありません。モニターを正常な状態に切り替えるには、ヘルス エクスプローラーを使用してモニターをリセットする必要があります。

Knowledge Base article:

概要

アプリケーション プールの仮想メモリまたは物理メモリの使用量が設定した制限に達したために、アプリケーション プールが頻繁にリサイクルされます。これは、アプリケーション プールを実行しているコード内でメモリ リークが発生している可能性があることを示しています。

構成

このモニターは、設定されたメモリ使用量のしきい値 (これは、IIS 管理ツール内で設定します) に達したことにより発生するアプリケーション プール リサイクル イベント数を監視します。このモニターに設定可能なパラメーターは 2 つあります。1 つめのパラメーターは "Number Of Occurrences" で、これはモニターが監視するイベントが、設定した時間間隔で発生する必要がある回数です。2 つめのパラメーターは "Number Of Minutes" で、これはモニターがイベント発生数を監視する時間間隔です。

原因

解決方法

IIS マネージャーを使用してアプリケーション プールの制限の設定を構成または確認するには:

注:これは手動リセット モニターであるため、問題の解決後、ヘルス エクスプローラーでこのモニターの状態をリセットする必要があります。これを行うには、モニターを右クリックし、[ヘルスのリセット] メニュー項目を選択します。モニターを手動でリセットしないと、正常な状態に切り替わりません。

Element properties:

TargetMicrosoft.Windows.InternetInformationServices.10.0.ApplicationPool
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.Windows.InternetInformationServices.10.0.RepeatedEventLogManualReset2StateMonitorType
RemotableTrue
AccessibilityPublic
Alert Message
Web アプリケーション コードのメモリ リークの可能性
サーバー {1} のアプリケーション プール {0} は、このアプリケーション プールに指定したメモリのしきい値を超えたために数回再起動されました。これは、Web アプリケーションのコードのメモリ リークの発生を示している可能性があります。
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.Windows.InternetInformationServices.10.0.ApplicationPool.MemoryLeak.Monitor" Accessibility="Public" Enabled="true" Target="Microsoft.Windows.InternetInformationServices.10.0.ApplicationPool" ParentMonitorID="SystemHealth!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="Microsoft.Windows.InternetInformationServices.10.0.RepeatedEventLogManualReset2StateMonitorType" ConfirmDelivery="false">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Microsoft.Windows.InternetInformationServices.10.0.ApplicationPool.MemoryLeak.Monitor_AlertMessageResourceID">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Warning</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Property[Type="IISCommon!Microsoft.Windows.InternetInformationServices.ApplicationPool"]/PoolID$</AlertParameter1>
<AlertParameter2>$Target/Host/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</AlertParameter2>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="PotentialMemoryLeakDetected" MonitorTypeStateID="RepeatedEventRaised" HealthState="Warning"/>
<OperationalState ID="Healthy" MonitorTypeStateID="ManualResetEventRaised" HealthState="Success"/>
</OperationalStates>
<Configuration>
<RepeatedComputerName>$Target/Host/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</RepeatedComputerName>
<RepeatedLogName>System</RepeatedLogName>
<RepeatedExpression>
<And>
<Expression>
<RegExExpression>
<ValueExpression>
<XPathQuery Type="UnsignedInteger">EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>MatchesRegularExpression</Operator>
<Pattern>^(5117|5077)$</Pattern>
</RegExExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Microsoft-Windows-WAS</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Params/Param[2]</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">$Target/Property[Type="IISCommon!Microsoft.Windows.InternetInformationServices.ApplicationPool"]/PoolID$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</RepeatedExpression>
<NumberOfSeconds>3600</NumberOfSeconds>
<NumberOfOccurrences>10</NumberOfOccurrences>
</Configuration>
</UnitMonitor>