I spent nearly the whole day and part of a previous one trying to figure out the fix to one dumb bug. Our application was crashing IIS on shutdown. The customer would like this fixed.
The problem turns out to be this one thread that always returns STILL_ACTIVE when you call GetExitCodeThread. Now the thread is dead. I mean I added tracing right before the thread returns 0 and I see that. I also tried calling ExitThread but that gave the same behavior.
The hang-up seems to be that the thread is waiting on an event. That event gets set by a destructor. For some reason that thread will not clean itself up until the destructor finishes. Kinda like the cleanup happens in a queue like fashion versus a stack, which I assumed.
It is the end of the day Friday. I added some good old fashioned sleeps in there to make sure the timing works but I am not happy. Still confused on this one.