Friday, March 11, 2016

Zombie Port Blocks

Recently I had the privilege of trying to debug a highly distributed system- there were two client processes that end up spawning other processes. Let's call the two client's Process A and Process B. While debugging in Visual Studio each of the processes crashed.

Subsequent times debugging the server/clients would outright fail! It was pretty bad. After some quick googling around, I found this stack overflow question:

http://stackoverflow.com/questions/8688949/how-to-close-tcp-and-udp-ports-via-windows-command-line

Yeah, the accepted answer isn't the right one. Check the steps listed on the most popular answer. Here's what you do:

> netstat -a -n -o

That will print out all of the processes that have opened ports. For me it showed that port 9001 (Process A) and 9002 (Process B) were open. Here is the caveat: the PID for each of those processes listed from netstat did not exist! The task manager did not show them.

What happened was that Process A and Process B both launched more processes before they crashed- this caused Windows to hold onto the ports until the processes completed. The way I solved my issue was finding the spawned processes and killing those. That ended up finishing Process A and Process B.

See this stack overflow question for more info:

http://stackoverflow.com/questions/15216881/pid-exists-in-netstat-but-does-not-exist-in-task-manager


No comments:

Post a Comment