Search Unity

Unity + WinDbg

Discussion in 'Editor & General Support' started by k0mbain, Jun 24, 2016.

  1. k0mbain

    k0mbain

    Joined:
    Nov 1, 2012
    Posts:
    22
    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?
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
  3. k0mbain

    k0mbain

    Joined:
    Nov 1, 2012
    Posts:
    22
    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.
     
  4. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    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).