Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Resolved Dedicated server Segmentation Fault

Discussion in 'Game Server Hosting' started by Kouznetsov, Mar 31, 2023.

  1. Kouznetsov

    Kouznetsov

    Joined:
    Aug 25, 2014
    Posts:
    7
    Hello,

    I have a dedicated server build based on Photon Fusion running on Unity Multiplay. Everything works fine in windows with my build, but when hosted on the Unity infrastructure, it happens to end with a segfault at seemingly random times.

    Here is the stacktrace:
    Code (JavaScript):
    1. Caught fatal signal - signo:11 code:0 errno:0 addr:(nil)
    2. Obtained 13 stack frames.
    3. #0  0x007ffa40c4c420 in funlockfile
    4. #1  0x007ffa40b2323f in clock_nanosleep
    5. #2  0x007ffa40b28ec7 in nanosleep
    6. #3  0x007ffa41a49391 in std::_Rb_tree<void const*, void const*, std::_Identity<void const*>, std::less<void const*>, std::allocator<void const*> >::_M_erase(std::_Rb_tree_node<void const*>*)
    7. #4  0x007ffa4191a303 in int* std::_V2::__rotate<int*>(int*, int*, int*, std::random_access_iterator_tag)
    8. #5  0x007ffa4191a3ca in int* std::_V2::__rotate<int*>(int*, int*, int*, std::random_access_iterator_tag)
    9. #6  0x007ffa4196e607 in int* std::_V2::__rotate<int*>(int*, int*, int*, std::random_access_iterator_tag)
    10. #7  0x007ffa419679b7 in int* std::_V2::__rotate<int*>(int*, int*, int*, std::random_access_iterator_tag)
    11. #8  0x007ffa41967972 in int* std::_V2::__rotate<int*>(int*, int*, int*, std::random_access_iterator_tag)
    12. #9  0x007ffa41967c5c in int* std::_V2::__rotate<int*>(int*, int*, int*, std::random_access_iterator_tag)
    13. #10 0x007ffa41b8fa47 in PlayerMain(int, char**)
    14. #11 0x007ffa40a6a083 in __libc_start_main
    15. #12 0x0055dd0d91c029 in (Unknown)
    16. Executing Unity Signal Handler
    Again, everything works perfectly on windows. at first I thought that the server the build was running on went low on resources, but after benchmarking how much RAM it used, everything should have been fine. My RAM usage on windows barely goes above 200MB and my server has 800MB allocated. I even tried allocating more, with 2GB RAM servers, but sadly got the same results.

    I'm not sure whether the issue comes from Unity or Fusion, so I'm also asking the question here. I thoroughly searched for people who may have the same issue and found a few segfaults of dedicated fusion servers running on linux but none of the stacktraces I fell upon looked like mine.
     
    Last edited: Mar 31, 2023
  2. unity_03BA514BAC145D0E9AB3

    unity_03BA514BAC145D0E9AB3

    Joined:
    Feb 18, 2023
    Posts:
    7
    Hi, I have a similar problem. My problem was because I set Scripting Backend with Mono to build our Linux dedicated server, and it caused a memory leak in Multiplay. Once we changed the Scripting Backend to IL2CPP the memory leak was gone.

    But actually, if we take a closer look the RAM usage is still increasing little by little even our game is not doing anything and this only happens after a player joins the server so it can also be on the Photon Fusion side.

    And also memory usage on Linux build is very high compared to Windows build. On Windows, when the server is running with players joined, memory usage is only 300mb but on Linux it can be 600mb and keeps increasing little by little.
     
  3. Kouznetsov

    Kouznetsov

    Joined:
    Aug 25, 2014
    Posts:
    7
    I've compiled with IL2CPP and the segfault disappeared indeed. Thanks!