Symptoms
Assume that you have an application or tool that is running in Windows 7 or Windows Server 2008 R2, and that the application or tool performs one or more of the following tasks:
-
Monitoring of another server by using ICMP or ping.exe
-
Starting multiple short-lived processes to perform a job, and the process is then stopped
-
Doing any network activity, and the process is then stopped by another application or script
In this situation, after your server runs continuously for several hours or several days, you notice that the Network Store Interface (NSI) service leaks memory. Additionally, you notice the following symptoms:
-
If you stop the monitoring software, the memory leak stops.
-
If you stop the application and then restart the computer, no memory leak occurs in the NSI service.
-
In some cases, if you disable and then enable the network adapter, you notice a sudden spike of CPU usage by the NSI service. Additionally, the memory usage immediately comes drops from 1 or 2 gigabytes (GB) to 200 or 300 megabytes (MB).
This problem may occur in any of the following scenarios.
Scenario 1
If an application such as ping.exe is forcibly stopped, it is possible that the IcmpCloseHandle function is not called. In this case, the NSI service may detect that there is a client available. Therefore, the service continually send notices about any ICMP messages. Because the client does not exist, the notification list continues to increase. The list does not get cleaned up until the NSI service is stopped.
To send a ping, you have to open the ICMP handle, and then use these other IP Helper functions to send and receive ICMP data:
After the application sends the ping, it must call the IcmpCloseHandle function to close the ICMP handle.
Scenario 2
A software developer creates an application to send and receive ICMP messages by using IPHlelper APIs. If only one ICMP handle is used to send ICMP messages for multiple clients, and if it does this does it at a very high rate, the IPHelper API that is notified when a message is received cannot maintain the speed. In this case, you notice that the NSI service memory continues to grow exponentially. Additionally, you notice high CPU usage by the NSI service (nsisvc.dll).
Scenario 3
You have an application or service that directly or indirectly uses IP Helper functions. The application stops or is stopped, and it does not exit gracefully when each notification registration is not canceled (CancelMibChangeNotify2). In this case, the NSI server keeps the registration pending for the process that is stopped. If there are many instances of application stoppage, the NSI service will have many lingering registrations. An RPC async state and other information is maintained for every registration. This adds to the memory usage. Typically, these registrations are made for an interface change or a Unicast IP address change. If there is no change in the state, these registrations are still maintained.
The following Notification functions are used during the registration process:
The reason that many applications do not call (CancelMibChangeNotify2) or stop the process is discussed in the NotifyIpInterfaceChange function topic on the Microsoft Developer Network website.
After the NotifyIpInterfaceChange function is called to register for change notifications, these notifications continue to be sent until the application unregisters to receive change notifications or the application stops. If the application stops, the system automatically unregisters any registration for change notifications. We recommend that you configure an application to explicitly unregister for change notifications before it stops.
For every registration for notification, you make also allocate some non-paged pool (NPP) memory for the the NSpc tag.
Cause
This problem occurs because the process that registers for notification exits without first unregistering from the NSI service. Therefore, the registration leak in NSI causes the memory leak in the NSI service. Additionally, the NPP leaks memory in the NSI Proxy Contexts Tag NSpc (NSI.dll).
Resolution
Hotfix information
A supported hotfix is available from Microsoft Support. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing the problem described in this article. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.
If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.
Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, go to the following Microsoft website:
http://support.microsoft.com/contactus/?ws=support
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.
Prerequisites
To apply this hotfix, you must have Service Pack 1 for Windows 7 or Windows Server 2008 R2 installed.
Restart requirement
You must restart the computer after you apply this hotfix.
Hotfix replacement information
This hotfix does not replace any previously released hotfix.
File information
The English (United States) version of this hotfix installs files that have the attributes that are listed in the following tables. The dates and the times for these files are listed in Coordinated Universal Time (UTC). The dates and the times for these files on your local computer are displayed in your local time together with your current daylight saving time (DST) bias. Additionally, the dates and the times may change when you perform certain operations on the files.
Windows 7 and Windows Server 2008 R2 file information and notes
Important Windows 7 hotfixes and Windows Server 2008 R2 hotfixes are included in the same packages. However, hotfixes on the Hotfix Request page are listed under both operating systems. To request the hotfix package that applies to one or both operating systems, select the hotfix that is listed under "Windows 7/Windows Server 2008 R2" on the page. Always refer to the "Applies To" section in articles to determine the actual operating system that each hotfix applies to.
-
The files that apply to a specific product, SR_Level (RTM, SPn), and service branch (LDR, GDR) can be identified by examining the file version numbers as shown in the following table.
Version
Product
SR_Level
Service branch
6.1.760 0. 16xxx
Windows 7 and Windows Server 2008 R2
RTM
GDR
6.1.760 1. 22xxx
Windows 7 and Windows Server 2008 R2
SP1
LDR
-
GDR service branches contain only those fixes that are widely released to address widespread, extremely important issues. LDR service branches contain hotfixes in addition to widely released fixes.
-
The MANIFEST files (.manifest) and the MUM files (.mum) that are installed for each environment are listed separately in the "Additional file information for Windows 7 and Windows Server 2008 R2" section.
-
MUM and MANIFEST files, and the associated security catalog (.cat) files, are extremely important to maintain the state of the updated components. The security catalog files, for which the attributes are not listed, are signed with a Microsoft digital signature.
For all supported x86-based versions of Windows 7
File name |
File version |
File size |
Date |
Time |
Platform |
Nsi.dll |
6.1.7600.16385 |
8,704 |
14-Jul-2009 |
01:16 |
x86 |
Nsiproxy.sys |
6.1.7600.16385 |
16,896 |
13-Jul-2009 |
23:12 |
x86 |
Nsisvc.dll |
6.1.7601.22590 |
20,480 |
05-Feb-2014 |
02:03 |
x86 |
Winnsi.dll |
6.1.7600.16385 |
16,896 |
14-Jul-2009 |
01:16 |
x86 |
For all supported x64-based versions of Windows 7 and Windows Server 2008 R2
File name |
File version |
File size |
Date |
Time |
Platform |
Nsi.dll |
6.1.7600.16385 |
13,824 |
14-Jul-2009 |
01:41 |
x64 |
Nsiproxy.sys |
6.1.7601.22590 |
24,576 |
05-Feb-2014 |
01:15 |
x64 |
Nsisvc.dll |
6.1.7601.22590 |
26,624 |
05-Feb-2014 |
02:42 |
x64 |
Winnsi.dll |
6.1.7600.16385 |
26,112 |
14-Jul-2009 |
01:41 |
x64 |
Nsi.dll |
6.1.7601.22590 |
8,704 |
05-Feb-2014 |
02:03 |
x86 |
Winnsi.dll |
6.1.7601.22590 |
16,896 |
05-Feb-2014 |
02:04 |
x86 |
For all supported IA-64-based versions of Windows Server 2008 R2
File name |
File version |
File size |
Date |
Time |
Platform |
Nsi.dll |
6.1.7600.16385 |
18,944 |
14-Jul-2009 |
01:48 |
IA-64 |
Nsiproxy.sys |
6.1.7601.22590 |
53,760 |
05-Feb-2014 |
00:50 |
IA-64 |
Nsisvc.dll |
6.1.7601.22590 |
60,928 |
05-Feb-2014 |
01:48 |
IA-64 |
Winnsi.dll |
6.1.7600.16385 |
38,912 |
14-Jul-2009 |
01:50 |
IA-64 |
Nsi.dll |
6.1.7601.22590 |
8,704 |
05-Feb-2014 |
02:03 |
x86 |
Winnsi.dll |
6.1.7601.22590 |
16,896 |
05-Feb-2014 |
02:04 |
x86 |
Additional file information for Windows 7 and Windows Server 2008 R2
Additional files for all supported x86-based versions of Windows 7
File name |
Package_1_for_kb2847346~31bf3856ad364e35~x86~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
1,822 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Package_2_for_kb2847346~31bf3856ad364e35~x86~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
1,805 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Package_3_for_kb2847346~31bf3856ad364e35~x86~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
1,807 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Package_for_kb2847346_rtm~31bf3856ad364e35~x86~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
1,459 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Package_for_kb2847346_sp1~31bf3856ad364e35~x86~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
1,918 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
X86_dfca12963d5c03edca970b29ad513eb4_31bf3856ad364e35_6.1.7601.22590_none_ff32d7aebbbb6891.manifest |
File version |
Not Applicable |
File size |
699 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
X86_microsoft-windows-usermodensi_31bf3856ad364e35_6.1.7601.22590_none_749890603f18301d.manifest |
File version |
Not Applicable |
File size |
8,301 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:38 |
Platform |
Not Applicable |
Additional files for all supported x64-based versions of Windows 7 and Windows Server 2008 R2
File name |
Amd64_37e172e525713d1718cb98daea282913_31bf3856ad364e35_6.1.7601.22590_none_9888f3a0165278fe.manifest |
File version |
Not Applicable |
File size |
1,048 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Amd64_3839818617f8250fd6f59e35da1df9bd_31bf3856ad364e35_6.1.7601.22590_none_8fbf427f98b0d1cb.manifest |
File version |
Not Applicable |
File size |
703 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Amd64_a9af583825031567fe0548a9c2c728ab_31bf3856ad364e35_6.1.7601.22590_none_59ced916edddc9da.manifest |
File version |
Not Applicable |
File size |
703 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Amd64_microsoft-windows-usermodensi_31bf3856ad364e35_6.1.7601.22590_none_d0b72be3f775a153.manifest |
File version |
Not Applicable |
File size |
8,305 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:41 |
Platform |
Not Applicable |
File name |
Package_1_for_kb2847346~31bf3856ad364e35~amd64~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
1,832 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Package_2_for_kb2847346~31bf3856ad364e35~amd64~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
2,237 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Package_3_for_kb2847346~31bf3856ad364e35~amd64~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
2,015 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Package_4_for_kb2847346~31bf3856ad364e35~amd64~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
2,036 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Package_for_kb2847346_rtm~31bf3856ad364e35~amd64~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
1,467 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Package_for_kb2847346_sp1~31bf3856ad364e35~amd64~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
2,830 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Wow64_microsoft-windows-usermodensi_31bf3856ad364e35_6.1.7601.22590_none_db0bd6362bd6634e.manifest |
File version |
Not Applicable |
File size |
4,690 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
02:16 |
Platform |
Not Applicable |
Additional files for all supported IA-64-based versions of Windows Server 2008 R2
File name |
Ia64_44d491142723affea686ec2fba3cb4ac_31bf3856ad364e35_6.1.7601.22590_none_dc26e555dbabe437.manifest |
File version |
Not Applicable |
File size |
1,046 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Ia64_microsoft-windows-usermodensi_31bf3856ad364e35_6.1.7601.22590_none_749a34563f163919.manifest |
File version |
Not Applicable |
File size |
8,303 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Package_1_for_kb2847346~31bf3856ad364e35~ia64~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
2,029 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Package_for_kb2847346_sp1~31bf3856ad364e35~ia64~~6.1.1.0.mum |
File version |
Not Applicable |
File size |
1,446 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
06:35 |
Platform |
Not Applicable |
File name |
Wow64_microsoft-windows-usermodensi_31bf3856ad364e35_6.1.7601.22590_none_db0bd6362bd6634e.manifest |
File version |
Not Applicable |
File size |
4,690 |
Date (UTC) |
05-Feb-2014 |
Time (UTC) |
02:16 |
Platform |
Not Applicable |
Workaround
To work around this problem, use one of the following workarounds as appropriate for your situation.
Workaround for Scenario 1
Make sure that the application, such as ping.exe, is not forcibly stopped. Instead, let the application gracefully shutdown.
Alternatively, upgrade to Windows Server 2012. This problem is fixed in Windows Server 2012. This fix prevents the NSI service from leaking memory regardless of how the application is stopped.
Workaround for Scenario 2
A software developer should create multiple ICMP handles to send ICMP requests. If you must send a large number of ICMP packets, you should use Raw sockets and directly send and receive ICMP packets on the RAW socket. This will give fastest performance.
Workaround for Scenario 3
In this scenario, if you disable and enable the network adapter, the memory usage immediately decreases but has a short spike of CPU usage.
This occurs because when a change occurs in the IP address or the interface, the NSI service is notified by the kernel. The NSI service then tries to notifiy all the clients that are registered for the notification. When the service tries to notify a client process that does not exist, the RPC reports an error. Therefore, the NSI service deletes all the state information that was saved for that client process. After this occurs, that memory is freed.
In this case, several hundred thousand notifications are registered. After the event occurs, all the memory for these invalid clients is freed.
This problem is fixed in Windows 8.