Search Unity

Linux server build: segmentation fault when launching the game

Discussion in 'Linux' started by IgorAherne, Feb 7, 2020.

  1. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    I seem to get segmentation fault when running my server build on linux ubuntu (a virtual server I am renting)

    First I build a standalone for linux on my windows machine, then upload everything into a /home/sp_game/ directory.

    This server doesn't have unity3D editor installed, and I just want to run the game on it.
    Using PuTTY I run these commands from the folder with the game:

    chmod +x sp_game_MATCHMAKER.x84_64
    ./sp_game_MATCHMAKER.x84_64


    However, I get this output in the terminal:

    Code (CSharp):
    1.  
    2. root@igor:/home/sp_planet/sp_game_MATCHMAKER# ./SP_matchmaker_linux.x86_64
    3. Set current directory to /home/sp_planet/sp_game_MATCHMAKER
    4. Found path: /home/sp_planet/sp_game_MATCHMAKER/SP_matchmaker_linux.x86_64
    5. Mono path[0] = '/home/sp_planet/sp_game_MATCHMAKER/SP_matchmaker_linux_Data/Managed'
    6. Mono config path = '/home/sp_planet/sp_game_MATCHMAKER/SP_matchmaker_linux_Data/MonoBleedingEdge/etc'
    7. Initialize engine version: 2019.3.0f3 (6c9e2bfd6f81)
    8. [Subsystems] Discovering subsystems at path /home/sp_planet/sp_game_MATCHMAKER/SP_matchmaker_linux_Data/UnitySubsystems
    9. Forcing GfxDevice: Null
    10. GfxDevice: creating device client; threaded=0
    11. NullGfxDevice:
    12.     Version:  NULL 1.0 [1.0]
    13.     Renderer: Null Device
    14.     Vendor:   Unity Technologies
    15. Begin MonoManager ReloadAssembly
    16. - Completed reload, in  0.141 seconds
    17. UnloadTime: 1.109229 ms
    18. Caught fatal signal - signo:11 code:2 errno:0 addr:0x7efb5cbffff0
    19. Obtained 29 stack frames.
    20. #0  0x007efd55543841 in DynamicHeapAllocator::CreateTLSFPool(unsigned long&)
    21. #1  0x007efd55543c2d in DynamicHeapAllocator::Allocate(unsigned long, int)
    22. #2  0x007efd5553d60e in MemoryManager::Allocate(unsigned long, unsigned long, MemLabelId, AllocateOptions, char const*, int)
    23. #3  0x007efd5553d33e in operator new(unsigned long, MemLabelId, unsigned long, char const*, int)
    24. #4  0x007efd55c3b11d in UNET::VirtualWsUserHost::Init(char const*, int)
    25. #5  0x007efd55c3af1b in UNET::NetLibraryManager::AddWsHost(UNETHostTopology const*, char const*, int)
    26. #6  0x007efd55c4f675 in NetworkTransport_CUSTOM_AddWsHostInternal(ScriptingBackendNativeObjectPtrOpaque*, ScriptingBackendNativeStringPtrOpaque*, int)
    27. Segmentation fault
    28. root@igor:/home/sp_planet/sp_game_MATCHMAKER#
    29.  
    30.  
    Maybe I missed something important? Like some library (...or even Mono) is not installed, that I am not aware of, etc?

    On windows machine, I am using Unity 2019.3.0f3 personal, building with Mono (not IL2CPP)
    On server that I am renting I have Ubuntu 18.04.3 LTS

    Edit 1:
    Tried building on windows machine, and running on windows (as .exe). Did it via cmd without issues, and the game continuously printed my "hello world" message into the window's command line, just as expected.

    However, linux still has segmentation fault if I try to do it there :(

    Edit 2:
    Made a completely new project, with just one script. It runs ok on linux, so I will now try to identify if it's a library or some script in my unity project that's causing the crash. Suspect it might be the analytics or advertisements

    Edit 3:
    Nope, didn't work - I disabled everything in the Services window inside Unity Editor, and removed all packages via the Package Manager window, yet still getting segmentation fault with my original project.

    Edit 4:
    It's happening due to NetworkTransport, as shown in the stacktrace above. Other scripts debug.log() during their Awake(), but when it gets to the networking script, it causes the crash. Continuing to search inside of it ...argghhh :'(
     
    Last edited: Feb 8, 2020
  2. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Found what's causing the crash: AddWebsocketHost()

    Code (CSharp):
    1.  
    2. public const int MATCHMAKER_PORT = 1777;
    3. public const int MATCHMAKER_WEB_PORT = 1778;
    4.  
    5. protected override void OnInit( ConnectionConfig cc ){
    6.         HostTopology topo =  new HostTopology(cc, ushort.MaxValue-1);// players and rooms can connect to us.
    7.         NetworkTransport.Init();
    8.         // ip is null, so that anyone can connect to our server, we are
    9.         // not limiting the server to any ip or to some specific "ip range":
    10.         this.hostId =  NetworkTransport.AddHost(topo, MATCHMAKER_PORT, null);
    11.         this.webHostId = NetworkTransport.AddWebsocketHost(topo, MATCHMAKER_WEB_PORT, null);//caused crash
    12.     }
    Because I am not intending to actually use websockets, simply removing this line solves the issue.
     
    sigil_tech likes this.
  3. sigil_tech

    sigil_tech

    Joined:
    Sep 18, 2019
    Posts:
    17
    You are a great person for sharing this.
     
    IgorAherne likes this.