Search Unity

How to debug an Infinite loop of headless server running in linux?

Discussion in 'Linux' started by erichen, May 18, 2017.

  1. erichen

    erichen

    Joined:
    May 13, 2015
    Posts:
    3
    The headless server occasionally occur cpu usage has been at 100%,we use gdb to debug and found that it is in the infinite loop.
    The problem is the backtrace only show the address of code, How to make gdb show more about function name and other messages?

    here is backtrace:
    #0 0x0000000041ee7e30 in ?? ()
    #1 0x0000000000000228 in ?? ()
    #2 0x00000000ffffffff in ?? ()
    #3 0x00000000a5443280 in ?? ()
    #4 0x00007f9d78002ae0 in ?? ()
    #5 0xb870586325443280 in ?? ()
    #6 0x00007f9c576b2f50 in ?? ()
    #7 0x000004d5ad27f480 in ?? ()
    #8 0x00007f9c6fd1e000 in ?? ()
    #9 0x00007f9c6153c000 in ?? ()
    #10 0xb8705863000000f9 in ?? ()
    #11 0x00007f9c6153c490 in ?? ()
    #12 0x00000000405c5579 in ?? ()
    #13 0x00007f9c85b45678 in ?? ()
    #14 0x00007ffd2e3494a0 in ?? ()
    #15 0x00007f9c60ac9de0 in ?? ()
    #16 0x00007f9c576b2f50 in ?? ()
    #17 0x00007f9d78016f50 in ?? ()
    #18 0x00007f9c000000e3 in ?? ()
    #19 0x00007f9c61538e70 in ?? ()
    #20 0x00000000405c53d3 in ?? ()
    #21 0x00007f9c576b2f50 in ?? ()
    #22 0x00007f9c578471b8 in ?? ()
    #23 0x00007f9d78002ae0 in ?? ()
    #24 0x00007f9c61538e70 in ?? ()
    #25 0xb870586325443280 in ?? ()
    #26 0x00000000405c5334 in ?? ()
    #27 0x00007f9c8d4187d0 in ?? ()
    #28 0x00007f9c63cf8bd0 in ?? ()
    #29 0x00007f9c578471b8 in ?? ()
    #30 0x00000000405c66ca in ?? ()
    #31 0x00007f9c61538f48 in ?? ()
    #32 0x0000000000000211 in ?? ()
    #33 0x0000000000000001 in ?? ()
    #34 0x00000000405c64b5 in ?? ()
    #35 0x00007f9c62f48900 in ?? ()
    #36 0x0000000041cf34fe in ?? ()
    #37 0x0000000003854090 in ?? ()
    #38 0x0000000003853f70 in ?? ()
    #39 0x0000000000000211 in ?? ()
    #40 0x00007f9c576b2f50 in ?? ()
    #41 0x0000000000000211 in ?? ()
    #42 0x00000000405c643b in ?? ()
    #43 0x00007f9c62f48900 in ?? ()
    #44 0x0000000041ee6dc4 in ?? ()
    #45 0x00007f9c8d4187d0 in ?? ()
    #46 0x0000000000000000 in ?? ()
     
  2. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
  3. erichen

    erichen

    Joined:
    May 13, 2015
    Posts:
    3
    I got backtrace in development build with profile. it seem to running Infinite loop the usage of CPU is 100%.

    #0 0x00000000009ede70 in BufferedSocketStream::IsConnected ()
    #1 0x00000000009eb5ed in SocketStream::SendAll ()
    #2 0x00000000009e5870 in SendMessage ()
    #3 0x00000000009e59db in GeneralConnection::SendMessage ()
    #4 0x0000000000a01b84 in ProfilerConnection::GetObjectMemoryProfile ()
    #5 0x00000000009e5d43 in GeneralConnection::poll ()
    #6 0x00000000009e3a39 in Poll ()
    #7 0x0000000000918209 in PlayerLoop ()
    #8 0x000000000048c158 in main ()
     
  4. Tak

    Tak

    Joined:
    Mar 8, 2010
    Posts:
    1,001
    This backtrace looks like it's sending profiling data. If you can run a development build, you could connect it to the profiler in Unity and get some more useful results: https://docs.unity3d.com/Manual/ProfilerWindow.html
     
  5. erichen

    erichen

    Joined:
    May 13, 2015
    Posts:
    3
    Yes, I am running Infinite loop because I using profiler to connect it.
    Reproduce the steps of running Infinite loop:
    1.I build a Linux version program with development build and autoconnect profiler(Unity version 5.4.3p2)
    2.run Linux version program in Ubuntu 16.04
    3.open unity's profiler in windows and active profiler to specify IP
    4.Profiler only shows less than a minute of information, there is no continued to display information
    5.check the program in Linux that using 100% CPU.
    6.using gdb to check it seem to running Infinite loop.

    after that, the profiler can NOT connect it again, and the game loop is not working(main loop is in Infinite loop).