godot icon indicating copy to clipboard operation
godot copied to clipboard

Godot (C#) source build frequently crashes on launch

Open jonathansty opened this issue 11 months ago • 2 comments

Tested versions

Builds tested:

  • Godot Engine v4.3.dev.mono.custom_build.fe01776f0: display frequent crashes on loading project
  • Godot Engine v4.3.dev.custom_build.fe01776f0: no issues
  • Release candidate v4.3-dev5-mono-win64: no issues
  • Godot Engine v4.2.2.rc.mono.custom_build.c61a68614: synced to 4.2 tag and rebuild and this one does not have the issue.

System information

Windows 11 23H2 - Godot Engine v4.3.dev.mono.custom_build.fe01776f0 (2024-03-16 12:12:53 UTC)

Issue description

Any custom build I produce locally on my own machine does not reliably launch the editor into a project. Loading up the project manager works fine but as soon as I attempt to load any project the editor occasionally just randomly closes. I did attempt to run dev builds and debug this locally but this issue does not happen when I compile with dev_build=yes

I tried forcing symbols on non dev builds by using debug_symbols=yes and managed to attach to it but this didn't really help me much as the locations where these crashes were happening changed everytime I tried debugging it. Not sure if this is due to optimization being applied or legit some corruption happening (like a memory stomp).

At first I thought this might have been some of my own changes, however I synced back to the main branch and retried this with an empty project and still get this issue.

I've attached the output I get when running with --verbose --editor --path <my_project>. After the last line the editor is not running anymore.

Godot Engine v4.3.verbose.output.txt

Steps to reproduce

  1. Follow build steps on Compiling with dotnet
  2. Create an empty project with a project.godot file.
  3. Run bin/godot.windows.editor.x86_64.mono.exe --verbose --editor --path <path_to_empty_project>

Minimal reproduction project (MRP)

N/A

jonathansty avatar Mar 17 '24 14:03 jonathansty

I've been doing some bisecting and testing this. Started from the 4.2.1-stable tag which doesn't have the issue.

I ended up finding that the last working change was 3cac01034480dcb114a7becd7892d005627b45fd. The change after (eccdf1a1e8a972b40d507321b925d756a50c2a9d) has the crash issue.

I also compiled this with ASAN:

=================================================================
==113436==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x12e29f47f408 at pc 0x7ff6925fd6cc bp 0x00b33c9fd0a0 sp 0x00b33c9fd0a0
WRITE of size 8 at 0x12e29f47f408 thread T0
    #0 0x7ff6925fd6cb in CSharpScript::CSharpScript F:\dev\godot-engine-ext\godot-engine\modules\mono\csharp_script.cpp:2790
    #1 0x7ff693654fed in EditorHelpHighlighter::EditorHelpHighlighter F:\dev\godot-engine-ext\godot-engine\editor\editor_help.cpp:3557
    #2 0x7ff69369912a in EditorHelpHighlighter::create_singleton F:\dev\godot-engine-ext\godot-engine\editor\editor_help.cpp:3428
    #3 0x7ff69371ec34 in EditorNode::_notification F:\dev\godot-engine-ext\godot-engine\editor\editor_node.cpp:582
    #4 0x7ff69371fd05 in EditorNode::_notificationv F:\dev\godot-engine-ext\godot-engine\editor\editor_node.h:126
    #5 0x7ff69a215c25 in Object::notification F:\dev\godot-engine-ext\godot-engine\core\object\object.cpp:846
    #6 0x7ff691748bf6 in Main::start F:\dev\godot-engine-ext\godot-engine\main\main.cpp:3642
    #7 0x7ff69166011d in widechar_main F:\dev\godot-engine-ext\godot-engine\platform\windows\godot_windows.cpp:179
    #8 0x7ff69165fdab in _main F:\dev\godot-engine-ext\godot-engine\platform\windows\godot_windows.cpp:204
    #9 0x7ff691660298 in main F:\dev\godot-engine-ext\godot-engine\platform\windows\godot_windows.cpp:218
    #10 0x7ff69b4f4b45 in __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    #11 0x7ff9aae1257c in BaseThreadInitThunk+0x1c (C:\Windows\System32\KERNEL32.DLL+0x18001257c)
    #12 0x7ff9abc0aa57 in RtlUserThreadStart+0x27 (C:\Windows\SYSTEM32\ntdll.dll+0x18005aa57)

0x12e29f47f408 is located 0 bytes to the right of 904-byte region [0x12e29f47f080,0x12e29f47f408)
allocated by thread T0 here:
    #0 0x7ff6916f96f5 in malloc D:\a\_work\1\s\src\vctools\asan\llvm\compiler-rt\lib\asan\asan_malloc_win_thunk.cpp:85
    #1 0x7ff69a137799 in Memory::alloc_static F:\dev\godot-engine-ext\godot-engine\core\os\memory.cpp:75
    #2 0x7ff693654fe0 in EditorHelpHighlighter::EditorHelpHighlighter F:\dev\godot-engine-ext\godot-engine\editor\editor_help.cpp:3557
    #3 0x7ff69369912a in EditorHelpHighlighter::create_singleton F:\dev\godot-engine-ext\godot-engine\editor\editor_help.cpp:3428
    #4 0x7ff69371ec34 in EditorNode::_notification F:\dev\godot-engine-ext\godot-engine\editor\editor_node.cpp:582
    #5 0x7ff69371fd05 in EditorNode::_notificationv F:\dev\godot-engine-ext\godot-engine\editor\editor_node.h:126
    #6 0x7ff69a215c25 in Object::notification F:\dev\godot-engine-ext\godot-engine\core\object\object.cpp:846
    #7 0x7ff691748bf6 in Main::start F:\dev\godot-engine-ext\godot-engine\main\main.cpp:3642
    #8 0x7ff69166011d in widechar_main F:\dev\godot-engine-ext\godot-engine\platform\windows\godot_windows.cpp:179
    #9 0x7ff69165fdab in _main F:\dev\godot-engine-ext\godot-engine\platform\windows\godot_windows.cpp:204
    #10 0x7ff691660298 in main F:\dev\godot-engine-ext\godot-engine\platform\windows\godot_windows.cpp:218
    #11 0x7ff69b4f4b45 in __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    #12 0x7ff9aae1257c in BaseThreadInitThunk+0x1c (C:\Windows\System32\KERNEL32.DLL+0x18001257c)
    #13 0x7ff9abc0aa57 in RtlUserThreadStart+0x27 (C:\Windows\SYSTEM32\ntdll.dll+0x18005aa57)

SUMMARY: AddressSanitizer: heap-buffer-overflow F:\dev\godot-engine-ext\godot-engine\modules\mono\csharp_script.cpp:2790 in CSharpScript::CSharpScript
Shadow bytes around the buggy address:
  0x050cf2b0fe30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x050cf2b0fe40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x050cf2b0fe50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x050cf2b0fe60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x050cf2b0fe70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x050cf2b0fe80: 00[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x050cf2b0fe90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x050cf2b0fea0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x050cf2b0feb0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x050cf2b0fec0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x050cf2b0fed0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
=================================================================
==113436==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x12e29f47f408 at pc 0x7ff6925fd6cc bp 0x00b33c9fd0a0 sp 0x00b33c9fd0a0
WRITE of size 8 at 0x12e29f47f408 thread T0
    #0 0x7ff6925fd6cb in CSharpScript::CSharpScript F:\dev\godot-engine-ext\godot-engine\modules\mono\csharp_script.cpp:2790
    #1 0x7ff693654fed in EditorHelpHighlighter::EditorHelpHighlighter F:\dev\godot-engine-ext\godot-engine\editor\editor_help.cpp:3557
    #2 0x7ff69369912a in EditorHelpHighlighter::create_singleton F:\dev\godot-engine-ext\godot-engine\editor\editor_help.cpp:3428
    #3 0x7ff69371ec34 in EditorNode::_notification F:\dev\godot-engine-ext\godot-engine\editor\editor_node.cpp:582
    #4 0x7ff69371fd05 in EditorNode::_notificationv F:\dev\godot-engine-ext\godot-engine\editor\editor_node.h:126
    #5 0x7ff69a215c25 in Object::notification F:\dev\godot-engine-ext\godot-engine\core\object\object.cpp:846
    #6 0x7ff691748bf6 in Main::start F:\dev\godot-engine-ext\godot-engine\main\main.cpp:3642
    #7 0x7ff69166011d in widechar_main F:\dev\godot-engine-ext\godot-engine\platform\windows\godot_windows.cpp:179
    #8 0x7ff69165fdab in _main F:\dev\godot-engine-ext\godot-engine\platform\windows\godot_windows.cpp:204
    #9 0x7ff691660298 in main F:\dev\godot-engine-ext\godot-engine\platform\windows\godot_windows.cpp:218
    #10 0x7ff69b4f4b45 in __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    #11 0x7ff9aae1257c in BaseThreadInitThunk+0x1c (C:\Windows\System32\KERNEL32.DLL+0x18001257c)
    #12 0x7ff9abc0aa57 in RtlUserThreadStart+0x27 (C:\Windows\SYSTEM32\ntdll.dll+0x18005aa57)

0x12e29f47f408 is located 0 bytes to the right of 904-byte region [0x12e29f47f080,0x12e29f47f408)
allocated by thread T0 here:
    #0 0x7ff6916f96f5 in malloc D:\a\_work\1\s\src\vctools\asan\llvm\compiler-rt\lib\asan\asan_malloc_win_thunk.cpp:85
    #1 0x7ff69a137799 in Memory::alloc_static F:\dev\godot-engine-ext\godot-engine\core\os\memory.cpp:75
    #2 0x7ff693654fe0 in EditorHelpHighlighter::EditorHelpHighlighter F:\dev\godot-engine-ext\godot-engine\editor\editor_help.cpp:3557
    #3 0x7ff69369912a in EditorHelpHighlighter::create_singleton F:\dev\godot-engine-ext\godot-engine\editor\editor_help.cpp:3428
    #4 0x7ff69371ec34 in EditorNode::_notification F:\dev\godot-engine-ext\godot-engine\editor\editor_node.cpp:582
    #5 0x7ff69371fd05 in EditorNode::_notificationv F:\dev\godot-engine-ext\godot-engine\editor\editor_node.h:126
    #6 0x7ff69a215c25 in Object::notification F:\dev\godot-engine-ext\godot-engine\core\object\object.cpp:846
    #7 0x7ff691748bf6 in Main::start F:\dev\godot-engine-ext\godot-engine\main\main.cpp:3642
    #8 0x7ff69166011d in widechar_main F:\dev\godot-engine-ext\godot-engine\platform\windows\godot_windows.cpp:179
    #9 0x7ff69165fdab in _main F:\dev\godot-engine-ext\godot-engine\platform\windows\godot_windows.cpp:204
    #10 0x7ff691660298 in main F:\dev\godot-engine-ext\godot-engine\platform\windows\godot_windows.cpp:218
    #11 0x7ff69b4f4b45 in __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    #12 0x7ff9aae1257c in BaseThreadInitThunk+0x1c (C:\Windows\System32\KERNEL32.DLL+0x18001257c)
    #13 0x7ff9abc0aa57 in RtlUserThreadStart+0x27 (C:\Windows\SYSTEM32\ntdll.dll+0x18005aa57)

SUMMARY: AddressSanitizer: heap-buffer-overflow F:\dev\godot-engine-ext\godot-engine\modules\mono\csharp_script.cpp:2790 in CSharpScript::CSharpScript
Shadow bytes around the buggy address:
  0x050cf2b0fe30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x050cf2b0fe40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x050cf2b0fe50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x050cf2b0fe60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x050cf2b0fe70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x050cf2b0fe80: 00[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x050cf2b0fe90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x050cf2b0fea0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x050cf2b0feb0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x050cf2b0fec0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x050cf2b0fed0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
Address Sanitizer Error: Heap buffer overflow

jonathansty avatar Mar 18 '24 08:03 jonathansty

CC @dalexeev

Sauermann avatar Mar 23 '24 17:03 Sauermann