Ok, the title might be a slightly rhetorical question:
I’m writing an application in C++ using VStudio.NET and Windows XP. The application asserts an error, I choose to examine it under a debugger, I fix the error, stop the application, and restart it. Upon restarting the application, it throws a different assertion — the socket cannot be bound, because it is already in use.
Kill the new incarnation, check the process table. No sign of the previous app. netstat.exe -a shows the port still bound.
Kill the debugger/dev environment, in case it has some of the resources still locked in limbo. netstat.exe -a shows the port still bound.
Log out and log back in. netstat.exe -a shows the port no longer bound.
What the fuck? All resources in use by a program should be released by the kernel when the process ends, even if it was under debugging when it ends. And where are these traces of the application hanging around that a session restart fixes it?