Deleting IP Address programmatically leads to system hang

Hello All,

I have added around 25k Ip addresses on my computer using AddIPAddress API in 100 threads, but when i use deleteIPAddress API in 100 threads to delete all IPs the system is not usable and about 98% of the CPU is used by SVCHost service.

Is there any other way to add IPaddress programmatically and delete them.

I have used net stat but it takes much more time than AddIpAddress API.

Thanks in advance.

Vibhor Mahajan

xxxxx@gmail.com wrote:

Hello All,

I have added around 25k Ip addresses on my computer using AddIPAddress API in 100 threads, but when i use deleteIPAddress API in 100 threads to delete all IPs the system is not usable and about 98% of the CPU is used by SVCHost service.

Is there any other way to add IPaddress programmatically and delete them.

That’s not a real-world situation. My advice is “don’t do that”.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

There are a number of components in the system what monitor the arrival and
depature of IP addresses. SVCHOST happens to be one process (one instance
of it anyway) that has a few of those entities running in it. What you are
doing is probably outside the scope of ‘reasonable operation’ for these
components (they would not typically expect, for instance, to see 100 IP
addresses appear and dissappear in a day let alone 25 thousand!). No
matter how you add or remove the addresses, these components will still wake
up (because of the IP address change notification) and try to figure out
what happened. Looping through the (usually linear) list of IP addresses
and finding which ones have been deleted can sure chew up lots of time.
Somebody who was not (like me) catching up on their sleep during that
algorithms class would probably remember how to describe the cost of that
algorithm (N factorial comes to mind) but none the less, it is a whole lot
of CPU to scan the list, figure out which address(es) have gone away, react,
and then do it again 'cause the event was signaled again for the next few
addreses.

You sure about needing to have 25K IP addresses? Is this some sort of
stress test for your code? Maybe you can trim the network bindings on the
adapter on which you are adding these addresses (take off NBT, MS Networking
Workstation/Server) and see if that helps. Also, make sure that (unless
you need them) Simple TCP/IP services are not loaded either.

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Thursday, July 20, 2006 1:26 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Deleting IP Address programmatically leads to system hang

Hello All,

I have added around 25k Ip addresses on my computer using AddIPAddress API
in 100 threads, but when i use deleteIPAddress API in 100 threads to delete
all IPs the system is not usable and about 98% of the CPU is used by SVCHost
service.

Is there any other way to add IPaddress programmatically and delete them.

I have used net stat but it takes much more time than AddIpAddress API.

Thanks in advance.

Vibhor Mahajan


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer