Search Unity

CPU time limit exceeded error when running a specific scene

Discussion in 'Linux' started by Morgoth890, Jun 23, 2021.

  1. Morgoth890

    Morgoth890

    Joined:
    Oct 8, 2018
    Posts:
    2
    Hello,

    I'm trying to port my game to Linux, everything works fine except this one scene that crashes the game violently every time it is started. There is no error log or stacktrace at all in the Player.log file. The only error I see is in the console that launched the game where it says "CPU time limit exceeded". I have also installed the Unity editor on Linux, and when I reach this scene the editor crashes with the exact same error in the console that booted up the editor (and no errors in Editor.log).
    I have tried on another Linux machine and I get the same crash.
    I checked my CPU time limit with "ulimit -a" and the "cpu time" is set to "unlimited".

    Something strange is that I could once start the scene and let it run for about 10 seconds before it crashed, but all the other times it just crashed straight away.

    I have tested with Unity 2020.3.5 and 2020.3.12.

    The game works fine on Windows and MacOS, this only happens on Linux.

    Any idea what could cause this?
     
    hadesfury likes this.
  2. Morgoth890

    Morgoth890

    Joined:
    Oct 8, 2018
    Posts:
    2
    I found the reason behind this crash. This comes from a weird interaction with a native library that is used by the project and that registers custom signal handlers to log stacktraces in case of crash. When custom signal handlers are registered there, the game will crash on Linux in that specific scene. It doesn't crash when registering the signals, it just crashes later IF those were registered. I disabled the custom signal handlers and it doesn't crash anymore.

    This doesn't really explain why it only crashes when the lib is ran from a Unity project. I execute the same code on a Linux system with a C++ terminal client and with unit tests and it doesn't crash, so that led me to think that the problem came from the Unity client, but it's more of a combination of Unity + custom signal handling in C++ (and maybe also the backward lib that is used to log stacktraces, but that is yet to be confirmed).
     
    hadesfury likes this.