Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Crash when using '-deepprofiling'

Discussion in 'Editor & General Support' started by Gladyon, Dec 19, 2019.

  1. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    Note sure if it is the correct forum, please indicate me the correct one if it isn't.


    I cannot profile while in release, it's always crashing.
    I build with these options:
    - BuildOptions.ConnectWithProfiler
    - BuildOptions.Development
    - BuildOptions.AllowDebugging

    Then, I start the executable (I am using Windows 7) in command line with the '-deepprofiling' parameter.
    It crashes soon after connecting to the Unity's profiler.
    If the project is open before I start the command, it crashes while loading the data (I see my progress bar, the background, hear the music, and then it crashes).
    If the project isn't loaded (Unity editor not started), then it works well, and crash a few seconds after I open the project in Unity.

    I see the Unity crash window briefly, and then a standard Windows crash window.

    All I have is the attached crash dump (obtained while launching the project from the command line and the Unity project open).
    The 'error.log' file contain a few errors, but I must admit that I don't really know what to think of these.
    The 'player.log' file contains that:
    This is always there, even when not profiling (except for the address which changes a bit) and seems to be completely harmless.
    It also contains a few strange things about 'skipping profile frame', not sure if they are important.


    Note that I work on that project for a few years now and I have no problem when not profiling in release or when profiling in the Unity editor.
    The crash only occurs when profiling in release (unfortunately it is the first time I tried that, so I do not know since when it began crashing).


    Does anyone can help me with that problem?
     

    Attached Files:

    alexeyzakharov likes this.
  2. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    @Gladyon thank you for reporting the issue!

    It might be the hint why crash happens. I remember there was an issue with crash on disabling profiler when running out of allowed memory. I'm pretty sure this was fixed in 2019.2. Could you please try https://docs.unity3d.com/2019.1/Documentation/ScriptReference/Profiling.Profiler-maxUsedMemory.html api/cmdline to see if that prevents the crash.

    Are you profiling the Player on the same machine?

    P.S.:
    Small correction - you build a Development Player, not Release Player according to BuildOptions.Development. Profiler is not available in Release builds.
     
  3. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    Thanks for your fast answer!

    About the memory, my computer has 12Gb of RAM, when I launch the project in command line I am at 54% of RAM used according to the Task Manager, when the crash occurs I am at 63% of RAM used, it never spikes over that.
    I am using Unity 2019.1.12, so it may be the issue.

    I tried with the command line parameters '-deepprofiling -profiler-maxusedmemory 16777216' when starting my project.
    Same crash.

    Yes, a Windows 7 64bits with 12Gb RAM.

    Thanks for the correction, I always confuse the terms 'release' and 'build', I will try not to make that mistake anymore.
     
    alexeyzakharov likes this.
  4. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    I forgot to add that I can connect to the profiler by launching the build without the '-deepprofiling' parameter an with the project is open in Unity.
    In that case, the profiler is connected to the build as it should, except of course that I do not have access to the deep profiling.
     
    alexeyzakharov likes this.
  5. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Thank you for trying this out. I think 16MB is not enough - it is already that number by default. Is there any difference if you specify 256MB?
     
  6. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    I tired 256Mb and 2.5Gb, same result.
     
    alexeyzakharov likes this.
  7. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
  8. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    Thank you for the time you're spending on that issue.
    Because of Christmas I will not have time for more tests in the next few days, but I intend to go to the bottom of this very soon.

    On my end I intended to update to Unity 2019.3, but I will probably update to Unity 2019.2 if 2019.3 isn't released in the coming week.
    That should give us more information about the problem, and if it is still there I intend to use dichotomy on my project to see when the problem appeared.
     
    alexeyzakharov likes this.
  9. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    I just tried 2019.2.17, and the behaviour is different.
    It doesn't crash anymore, but it freezes.
    Well, it's not really freezed. My main progress bar freezes while the project is still alive as I have a moving object which still moves.
    The difference is that the progress bar is executing on another thread while the moving object is on the main thread.

    Also, if stops at different places when I try again.
    And of course, without '-deepprofiling' it works very well, and that part of the project is working fine for more than 2 years now.


    [Edit] Note that I also have a keep-alive thread and a logging thread, which are both different from the thread the progress bar is using to execute the underlying code.
    Sometimes I get the delayed logs (indicating a thread is frozen), sometimes not.
    It means that several threads are frozen, but not always all of them.
    And the main thread is never frozen.
     
    Last edited: Dec 26, 2019
    alexeyzakharov likes this.