Greetings, All
I got a very strange problem with .NET and asking your advise
I'm developing MMORPG game server in .NET. It uses aync sockets and a separate thread for message processing. All works perfectly but after a few hours CPU load of server PC raises to 100%. I'm profiling all of async receive/send/accept threads (writing its ID's to logfile) and when I enumerate process.Threads, none of 'em uses such much CPU. But there is always one 'fantom' thread in process.Threads collection, consuming all of CPU time. It is neither program main thread, nor async threads. It's start time shows that it was startet few seconds before hight load and it never appears in log files.
I've tried different profilers, but nothing helped. That problem appears only when more then ten users are online and I cannot reproduce it on clean PC.
Tried playing with different framework versions (1.0 - 2.0 beta), [STAThread] and so on..
Please help me to catch that nasty bug..

Strange problem in .NET console application
tfeaster
Answer is there:
http://forums.microsoft.com/msdn/ShowPost.aspx PostID=16564
michaelos
That is my problem:
http://forums.microsoft.com/msdn/ShowPost.aspx PostID=16535
I've tried using CLR Profiler, but it works so slowly that my application starts for an hour and temporary files filled entire HD :(
PeterSt
It's hard to say what the problem could be without more detail on the application scenario, code behavior, and thread details.
Is the thread managed or native Have you tried breaking into a native debugger (such as ntsd or windbg) and looking at the thread's callstack Is it "looping" on an expensive operation
It appears you tried to use the CLRProfiler and had some difficulty. Have you had any success since
Thanks,
Stephen
http://blogs.msdn.com/stfisher
Anil Alex Mathew - Valiyaveetil
Okay, now this could be the garbage collection running.
Is your memory usage stable or does it continue to increase
Paul Wyatt
Its not clear what is the problem you are facing Are you running out memory
In case you have not cleaned up unmanaged resources such as database connections or file handles or COM+ objects then that is a leak in those resources.
You need to dispose unmanaged resources correctly. Also, the CLR Profiler is a good tool which should help you detect leaks.
How To: Use CLR Profiler
Regards,
Vikram
404 Joe
1. I've added a frequent calls from main thread to
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
Always passes, even in hang-time
2. Added calls to
GC.Collect(0);
GC.Collect(1);
GC.Collect(2);
Same as above
3. Created some destructors and added loggin to 'em. It reports one of threads that starts along with main threads and destruction operation always passes correctly.
While this "hang" all of server features continue to work correctly, but very slow. Strage thing happens when I minimize and then restore server's console window - in a few seconds "fantom" thread suddenly disappears and server operates normally for next several hours..
AFAIK, after after program minimization Windows releases program's unused memory, but how can it be connected to my strange problem
rbedick
Full description of the problem you can see here: http://forums.microsoft.com/msdn/ShowPost.aspx PostID=16535
My program generates "phantom" thread (neither one of my threads, nor one of async completion threads) after a few hours of normal work, and that thread consumes 100% of CPU time until program window is minimized or a call landed to
Process process = Process.GetCurrentProcess(); SetProcessWorkingSetSize(process.Handle,-1,-1);
If someone knows what problem leads to this behaivor - please, help me..