I'm at my wit's end trying to debug a Windows Service I've written and could really use some help.
The application monitors my local network using WMI to monitor performance (Win32_Perfmon classes) of each machine every 15 minutes. A new thread is spawned for every machine to query its WMI repository and each thread terminates when the WQL query is answered & saved to the DB.
The application works fine until a certain, unspecified event occurs that bombs out the application (typically overnight). Virtually every single line of code is inside of a try/catch block which uses Trace.WriteLine inside of the catch block to write errors to a trace log file. When the application does its mysterious crash (memory & a few threads are still allocated, they just seemed deadlocked as if they're waiting for something) no critical errors appear in the trace log.
Does anyone have any tips on how in the #$&$ I can debug this thing?? Any advice would be appreciated

1 answers
Only thing I can think of is the old-fashioned "Verbose" method--put a trace in front of everything.
We recently ran into an issue where we would make a call to a server...and nothing would happen. No timeout, no error, nothing. Program is running, but no response. Fortunately for us, it was a problem on that server, and the DB2 guys had to deal with it, and got it working again (though, its a little frightening to think it could come back once we're in prod...)
Good luck.
Oh, one other possibility, though I'm not sure how you'd do it exactly..unless you are throwing your own errors. Put a trace in the constructor of any custom errors you could use...that's really the only other thing I can think of..but I'd guess you're getting a system error, and I don't think you could jump in there and get that.
Sorry.<img src="/Forums/skins/default/images/emotions/emotion-6.gif" border="0" alt="Sad" />
answered 2 years ago by:
0
Oh yes, I am being VERY verbose. Nothing unusual is happening. I'm wondering if it may be a memory leak or some other resource issue, so that when normal events occur a certain number of times or in a certain order, I get an unusual response from a fairly typical request.
When I've encountered memory allocation errors in the past, I've still been able to capture the error using try/catch.
One other interesting note. When the application is healthy there are about 9-10 threads active. One of those is a Timer-created thread that handles all of the other thread spawning/aborting. When the app has acted up, the number of active threads is 8, suggesting that the Timer thread has disappeared.
What happens when a Timer tries to run and there aren't adequate resources? Is it possible to capture that code anywhere? The Timer call is obviously asynchronous and is happening somewhere in the ether...
answered 2 years ago by:
0
Timers throw Semaphore errors, if I recall...though that doesn't really help you.
answered 2 years ago by:
0
This post was imported from csharpfriends, if you have a similiar question please ask it again.
All previous members have been migrated, hope you enjoy the new platform!