We have a problem with our game's server which is made in Unity as a game itself. We have found that server crashes due to handle leak - handles in process are increasing to ~170k and after few hours the process crashes without any crashdump or logs.The only things we can observe is increaing of Handles in Task Manager: https://gyazo.com/728756a1342943df7b985fe0a134f5bc When the number of handles reaches about 100k the processor increases its usage to about 90-100%. We have tried using WinDbg according to below descriptions: http://docs.unity3d.com/Manual/WindowsDebugging.html https://blogs.technet.microsoft.com/yon ... ndle-leak/ but after attaching WinDbg the observed process hangs and we cannot gather any data. I've tried attaching with Visual Studio's Diagnostic Tools, but I don't know if and how can I see handles in debugged process. I don't know if it's Unity's issue or I'm doing something wrong? Can I do something else?
Did you try to use Process explorer or "Handle" as this link suggests: https://blogs.technet.microsoft.com/yongrhee/2011/12/19/how-to-troubleshoot-a-handle-leak/ These are able to show you the handles you have open for a given process. This may give you some indication of what's going on.
Yes, I tried ProcessExplorer, but I cannot interpret what its output: https://1drv.ms/x/s!AuXaqws7vX3Igcggbc14XXUrjVIe7g The only thing I see is a lot of event (which I already know they are leaking), and theirs adresses in memory. I suppose there's some events which are not unsubscribed from listeners or the event publisher is destroyed but I don't know how to figure out the one which is leaking. I'll try to register all subscribtions and unsubscriptions of events in some Dictionary<string, int> and see which event has a lot more subs than unsubs.
The events you see are not events you use in C#. In this context, i believe events are synchronization primitives used by the OS. See here for more info: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682655(v=vs.85).aspx Without knowing your codebase it's hard to know whats exactly going on there (whether this is an internal Unity issue, something in your code or some other 3rd party plugin).