Search Unity

Bug crash when exit player of standalone windows

Discussion in 'Windows' started by qilin598866753, Dec 14, 2022.

  1. qilin598866753

    qilin598866753

    Joined:
    Nov 28, 2021
    Posts:
    20
    My unity version is 2021.3.15f1c1, my project use URP. I build standalone windows player, run it then exit, crash will always occurs。

    trace info:

    # Child-SP RetAddr Call Site
    00 0000001a`292ff100 00007ffd`9675fcb4 ntdll!RtlpWaitOnCriticalSection+0xa6
    01 0000001a`292ff1e0 00007ffd`9675fae2 ntdll!RtlpEnterCriticalSectionContended+0x1c4
    02 0000001a`292ff240 00007ffd`250ea695 ntdll!RtlEnterCriticalSection+0x42
    03 0000001a`292ff270 00007ffd`250f020a mono_2_0_bdwgc!mono_profiler_init_etw+0x8d5
    04 0000001a`292ff2b0 00007ffd`250347c5 mono_2_0_bdwgc!mono_thread_internal_current+0xe3a
    05 0000001a`292ff2e0 0000012b`76e6181d mono_2_0_bdwgc!mono_lookup_icall_symbol+0x29fc5
    06 0000001a`292ff4a0 0000012b`76e61753 0x0000012b`76e6181d
    07 0000001a`292ff530 0000012b`75dcebbb 0x0000012b`76e61753
    08 0000001a`292ff570 0000012b`75dce893 0x0000012b`75dcebbb
    09 0000001a`292ff600 0000012b`d1bd09d3 0x0000012b`75dce893
    0a 0000001a`292ff640 0000012a`a6b4183c 0x0000012b`d1bd09d3
    0b 0000001a`292ff6b0 00007ffd`25150ba5 0x0000012a`a6b4183c
    0c 0000001a`292ff740 00007ffd`25151c5e mono_2_0_bdwgc!mono_callspec_cleanup+0x14e5
    0d 0000001a`292ff820 00007ffd`251521d3 mono_2_0_bdwgc!mono_gc_finalize_notify+0x32e
    0e 0000001a`292ff880 00007ffd`250ed2db mono_2_0_bdwgc!mono_gc_finalize_notify+0x8a3
    0f 0000001a`292ff8f0 00007ffd`250ed4b6 mono_2_0_bdwgc!mono_profiler_init_etw+0x351b
    10 0000001a`292ffaa0 00007ffd`953274b4 mono_2_0_bdwgc!mono_profiler_init_etw+0x36f6
    11 0000001a`292ffad0 00007ffd`967826a1 KERNEL32!BaseThreadInitThunk+0x14
    12 0000001a`292ffb00 00000000`00000000 ntdll!RtlUserThreadStart+0x21
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Are you able to share a crash dump from this crash?
     
  3. qilin598866753

    qilin598866753

    Joined:
    Nov 28, 2021
    Posts:
    20
    i get the dump, but it's too large to upload, and thank u.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you put it in a zip file and then upload to some kind of file share service like google drive?
     
  5. qilin598866753

    qilin598866753

    Joined:
    Nov 28, 2021
    Posts:
    20
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Yup!

    It seems the crash happens because your code calls Thread.Abort() inside a C# finalizer. Here's the reconstructed callstack:

    Code (csharp):
    1. 000001e06be61c9d() // Thread.Abort_Internal
    2. 000001e06be61bd3() // Thread.Abort
    3. 000001e068d0f34b() // NetworkLib.NetworkManager.Close
    4. 000001e068d0f023() // NetworkLib.NetworkManager.Clear
    5. 000001e0ce9d54e3() // NetworkLib.NetworkManager.Finalize
    6. 000001df960a183c() // System.Object.runtime_invoke_virtual_void__this__
    This is probably a bug in Unity, as we shouldn't crash like that (if you report a bug, we might fix it). However, calling Thread.Abort() in general is a pretty bad idea. I would use different interrupt mechanisms like System.Threading.ManualResetEvent instead.
     
  7. qilin598866753

    qilin598866753

    Joined:
    Nov 28, 2021
    Posts:
    20
    Thank u very much. My unity version is updated from 2020.3 to 2021.3. My project is worked well in 2020.3, so i have the question. I will check my code and thank you once again.
     
  8. qilin598866753

    qilin598866753

    Joined:
    Nov 28, 2021
    Posts:
    20
    Hi, master. It seems difficult to analyse with minidump. Rencnetly i try to use Windbg and Visual Studio to analyse, but not find a way to map addresss to method name. I have read Manual of WindowsDebugging, and tried mono_pmip command in visual studio, but it doesn't work with minidump. So how do you map addresss to method name. I'm looking forward to your reply.
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    There is no straightforward/easy way to do it. The way I do it is locate a MonoDomain pointer somewhere on the stack, then look at jit_info_table field. It contains all managed functions in it and it is sorted, so you can do a "binary search" manually. It is tedious but at least allows figuring out what went wrong when everything else fails.
     
  10. qilin598866753

    qilin598866753

    Joined:
    Nov 28, 2021
    Posts:
    20
    so cool, thanks.;)