I have written a multi-threaded Windows service. I developed it in such a way that the core logic is a separate class library from the actual service project, so I could test the .DLL in a console. In the console test app, the app will run for days on end without a problem. All necessary calls are thread safe (lock). However, when plugged into the Windows service, the darn thing simply grinds to a halt i a matter of minutes. No exceptions, no logging, nothing.
A processing thread is manually spawned that polls a DB every so often. the information obtained from the db is then queued up in another thread that is spawned manually. I manually create the threads since these processes can run for several minutes each. I internally manage the number of threads created and limit it to a set amount. If max number of thread are running, it waits until a thread dies, then launches itself. I was using the ThreadPool, but thought that I maybe having conflicts and ldead-locking since I do my I/O asynchronously delegate calls - that being why I create the threads manually (I read in an article by John Skeet that the ThreadPool should only be used for short lived processes, and that it is used by async delegate calls). If anybody can point me in the right direction on getting this thing to run, it would be greatly appreciated.