godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.04k stars 20.19k forks source link

OSX Segfault when exporting with defaults #56918

Open Toasterson opened 2 years ago

Toasterson commented 2 years ago

Godot version

3.4

System information

macOS 11.3 (20E217) ARM-64 and Mac OS X 10.12.6 (16G29) x86_64 GLES3

Issue description

When starting the Exported Game on a Mac it crashes with a segfault: The details on both Architectures are a bit different but the Segfault occurs on the same memory section: KERN_INVALID_ADDRESS at 0x0000000000000010

ARM-64:

Process:               Anitya Demo [2437]
Path:                  /Applications/Anitya Demo.app/Contents/MacOS/Anitya Demo
Identifier:            app.anitya
Version:               0.1 (0.1.0)
Code Type:             ARM-64 (Native)
Parent Process:        ??? [1]
Responsible:           Anitya Demo [2437]
User ID:               501

Date/Time:             2022-01-19 01:37:58.782 +0700
OS Version:            macOS 11.3 (20E217)
Report Version:        12
Anonymous UUID:        AF81FC7A-B222-7301-1A19-E40AC4861FEB

Sleep/Wake UUID:       B032FB61-C4FA-4F10-8345-F42D80163BB4

Time Awake Since Boot: 14000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000010
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [2437]

VM Regions Near 0x10:
--> 
    __TEXT                      104b8c000-106aac000    [ 31.1M] r-x/r-x SM=COW  /Applications/Anitya Demo.app/Contents/MacOS/Anitya Demo

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   app.anitya                      0x00000001061785d4 0x104b8c000 + 22988244
1   app.anitya                      0x0000000104d704b8 0x104b8c000 + 1983672
2   app.anitya                      0x00000001060b4870 0x104b8c000 + 22186096
3   app.anitya                      0x0000000104d76718 0x104b8c000 + 2008856
4   app.anitya                      0x00000001060a8e50 0x104b8c000 + 22138448

Thread 1:
0   libsystem_pthread.dylib         0x00000001911d1d28 start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib         0x00000001911d1d28 start_wqthread + 0

Thread 3:
0   libsystem_pthread.dylib         0x00000001911d1d28 start_wqthread + 0

Thread 4:
0   libsystem_pthread.dylib         0x00000001911d1d28 start_wqthread + 0

Thread 5:
0   libsystem_kernel.dylib          0x00000001911a05c8 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x00000001911d7508 _pthread_cond_wait + 1248
2   libc++.1.dylib                  0x0000000191131efc std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28
3   app.anitya                      0x00000001062cff20 _IP_ResolverPrivate::_thread_function(void*) + 132
4   libsystem_pthread.dylib         0x00000001911d1d3c thread_start + 8

Thread 6:
0   libsystem_pthread.dylib         0x00000001911d1d28 start_wqthread + 0

Thread 7:
0   libsystem_kernel.dylib          0x00000001911a05c8 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x00000001911d7508 _pthread_cond_wait + 1248
2   libc++.1.dylib                  0x0000000191131efc std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28
3   app.anitya                      0x0000000105edbd68 0x104b8c000 + 20249960
4   libsystem_pthread.dylib         0x00000001911d1d3c thread_start + 8

Thread 8:: AMCP Logging Spool
0   libsystem_kernel.dylib          0x000000019119ce90 semaphore_wait_trap + 8
1   com.apple.audio.caulk           0x0000000198f47934 caulk::mach::semaphore::wait_or_error() + 28
2   com.apple.audio.caulk           0x0000000198f316e0 caulk::semaphore::timed_wait(double) + 168
3   com.apple.audio.caulk           0x0000000198f315cc caulk::concurrent::details::worker_thread::run() + 44
4   com.apple.audio.caulk           0x0000000198f3130c void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, void (caulk::concurrent::details::worker_thread::*)(), std::__1::tuple<caulk::concurrent::details::worker_thread*> > >(void*) + 96
5   libsystem_pthread.dylib         0x00000001911d6fd4 _pthread_start + 320
6   libsystem_pthread.dylib         0x00000001911d1d3c thread_start + 8

Thread 9:
0   libsystem_kernel.dylib          0x000000019119cea8 semaphore_timedwait_trap + 8
1   libdispatch.dylib               0x0000000191028474 _dispatch_sema4_timedwait + 64
2   libdispatch.dylib               0x0000000191028a84 _dispatch_semaphore_wait_slow + 76
3   libdispatch.dylib               0x0000000191039430 _dispatch_worker_thread + 304
4   libsystem_pthread.dylib         0x00000001911d6fd4 _pthread_start + 320
5   libsystem_pthread.dylib         0x00000001911d1d3c thread_start + 8

Thread 10:: com.apple.audio.IOThread.client
0   libsystem_kernel.dylib          0x000000019119ce54 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000019119d204 mach_msg + 76
2   com.apple.audio.CoreAudio       0x0000000192c9a918 HALB_MachPort::SendSimpleMessageWithSimpleReply(unsigned int, unsigned int, int, int&, bool, unsigned int) + 104
3   com.apple.audio.CoreAudio       0x0000000192b5bed0 invocation function for block in HALC_ProxyIOContext::HALC_ProxyIOContext(unsigned int, unsigned int) + 2928
4   com.apple.audio.CoreAudio       0x0000000192cd5b04 HALB_IOThread::Entry(void*) + 88
5   libsystem_pthread.dylib         0x00000001911d6fd4 _pthread_start + 320
6   libsystem_pthread.dylib         0x00000001911d1d3c thread_start + 8

Thread 11:
0   libsystem_kernel.dylib          0x000000019119cea8 semaphore_timedwait_trap + 8
1   libdispatch.dylib               0x0000000191028474 _dispatch_sema4_timedwait + 64
2   libdispatch.dylib               0x0000000191028a84 _dispatch_semaphore_wait_slow + 76
3   libdispatch.dylib               0x0000000191039430 _dispatch_worker_thread + 304
4   libsystem_pthread.dylib         0x00000001911d6fd4 _pthread_start + 320
5   libsystem_pthread.dylib         0x00000001911d1d3c thread_start + 8

Thread 12:: com.apple.NSEventThread
0   libsystem_kernel.dylib          0x000000019119ce54 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x000000019119d204 mach_msg + 76
2   com.apple.CoreFoundation        0x00000001912d5e9c __CFRunLoopServiceMachPort + 372
3   com.apple.CoreFoundation        0x00000001912d4368 __CFRunLoopRun + 1212
4   com.apple.CoreFoundation        0x00000001912d3734 CFRunLoopRunSpecific + 600
5   com.apple.AppKit                0x0000000193c3a3e8 _NSEventThread + 196
6   libsystem_pthread.dylib         0x00000001911d6fd4 _pthread_start + 320
7   libsystem_pthread.dylib         0x00000001911d1d3c thread_start + 8

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000126eabae8   x1: 0x0000600002f220f0   x2: 0x000000016b2714e0   x3: 0x0000000000000002
    x4: 0x000000016b2714b0   x5: 0x000000016b271608   x6: 0x0000000191197220   x7: 0x000000000000003e
    x8: 0x00006000020b9290   x9: 0x0000000000000010  x10: 0x0000000000000018  x11: 0x0000000000000000
   x12: 0x0000000126eabae8  x13: 0x000000016b2714e0  x14: 0x0000000000000000  x15: 0x00000000000000a0
   x16: 0x0000000191196b24  x17: 0x0000000190ffa9fc  x18: 0x0000000139833940  x19: 0x000000016b2714b0
   x20: 0x000000016b271608  x21: 0x0000000000000002  x22: 0x0000000126eabae8  x23: 0x0000600002f220f0
   x24: 0x000000010682cfda  x25: 0x0000000000000002  x26: 0x0000000000000004  x27: 0x000000016b271450
   x28: 0x000000010679ac3e   fp: 0x000000016b2717c0   lr: 0x0000000104d704b8
    sp: 0x000000016b2713b0   pc: 0x00000001061785d4 cpsr: 0x80000000
   far: 0x0000000000000010  esr: 0x92000006

Details Intel:

Process:               Anitya Demo [1036]
Path:                  /Applications/Anitya Demo.app/Contents/MacOS/Anitya Demo
Identifier:            app.anitya
Version:               0.1 (0.1.0)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Anitya Demo [1036]
User ID:               501

Date/Time:             2022-01-19 01:49:24.817 +0700
OS Version:            Mac OS X 10.12.6 (16G29)
Report Version:        12
Anonymous UUID:        E53E6597-AD09-726C-0EB7-35D5D4C05719

Sleep/Wake UUID:       D28F97AB-EAC6-4BA0-800B-F4BF83CDD2B9

Time Awake Since Boot: 20000 seconds
Time Since Wake:       7900 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000010
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0x10:
--> 
    __TEXT                 00000001001e5000-0000000102250000 [ 32.4M] r-x/r-x SM=COW  /Applications/Anitya Demo.app/Contents/MacOS/Anitya Demo

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   app.anitya                      0x0000000101a415b0 0x1001e5000 + 25544112
1   app.anitya                      0x00000001003e546f 0x1001e5000 + 2098287

Thread 1:
0   libsystem_kernel.dylib          0x00007fffcade944e __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fffcaed3621 _pthread_wqthread + 1426
2   libsystem_pthread.dylib         0x00007fffcaed307d start_wqthread + 13

Thread 2:
0   libsystem_kernel.dylib          0x00007fffcade944e __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fffcaed348e _pthread_wqthread + 1023
2   libsystem_pthread.dylib         0x00007fffcaed307d start_wqthread + 13

Thread 3:
0   libsystem_kernel.dylib          0x00007fffcade944e __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fffcaed3621 _pthread_wqthread + 1426
2   libsystem_pthread.dylib         0x00007fffcaed307d start_wqthread + 13

Thread 4:
0   libsystem_kernel.dylib          0x00007fffcade944e __workq_kernreturn + 10
1   libsystem_pthread.dylib         0x00007fffcaed3621 _pthread_wqthread + 1426
2   libsystem_pthread.dylib         0x00007fffcaed307d start_wqthread + 13

Thread 5:
0   libsystem_kernel.dylib          0x00007fffcade8bf2 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fffcaed47fa _pthread_cond_wait + 712
2   libc++.1.dylib                  0x00007fffc98514cd std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 47
3   app.anitya                      0x0000000101bb873b _IP_ResolverPrivate::_thread_function(void*) + 155
4   libsystem_pthread.dylib         0x00007fffcaed3887 _pthread_start + 286
5   libsystem_pthread.dylib         0x00007fffcaed308d thread_start + 13

Thread 6:
0   libsystem_kernel.dylib          0x00007fffcade8bf2 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fffcaed47fa _pthread_cond_wait + 712
2   libc++.1.dylib                  0x00007fffc98514cd std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 47
3   app.anitya                      0x000000010176674b 0x1001e5000 + 22550347
4   ???                             0x00007000046b2001 0 + 123145376440321

Thread 7:
0   libsystem_kernel.dylib          0x00007fffcade139e semaphore_timedwait_trap + 10
1   libdispatch.dylib               0x00007fffcac9cb09 _os_semaphore_timedwait + 72
2   libdispatch.dylib               0x00007fffcac8d864 _dispatch_semaphore_wait_slow + 58
3   libdispatch.dylib               0x00007fffcac88290 _dispatch_worker_thread + 275
4   libsystem_pthread.dylib         0x00007fffcaed393b _pthread_body + 180
5   libsystem_pthread.dylib         0x00007fffcaed3887 _pthread_start + 286
6   libsystem_pthread.dylib         0x00007fffcaed308d thread_start + 13

Thread 8:: com.apple.audio.IOThread.client
0   libsystem_kernel.dylib          0x00007fffcade134a mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fffcade0797 mach_msg + 55
2   com.apple.audio.CoreAudio       0x00007fffb50a4935 HALB_MachPort::SendMessageWithReply(unsigned int, unsigned int, unsigned int, unsigned int, mach_msg_header_t*, bool, unsigned int) + 127
3   com.apple.audio.CoreAudio       0x00007fffb50a48a6 HALB_MachPort::SendSimpleMessageWithSimpleReply(unsigned int, unsigned int, int, int&, bool, unsigned int) + 42
4   com.apple.audio.CoreAudio       0x00007fffb50a18d0 HALC_ProxyIOContext::IOWorkLoop() + 1196
5   com.apple.audio.CoreAudio       0x00007fffb50a1264 HALC_ProxyIOContext::IOThreadEntry(void*) + 128
6   com.apple.audio.CoreAudio       0x00007fffb50a0fa3 HALB_IOThread::Entry(void*) + 75
7   libsystem_pthread.dylib         0x00007fffcaed393b _pthread_body + 180
8   libsystem_pthread.dylib         0x00007fffcaed3887 _pthread_start + 286
9   libsystem_pthread.dylib         0x00007fffcaed308d thread_start + 13

Thread 9:: com.apple.NSEventThread
0   libsystem_kernel.dylib          0x00007fffcade134a mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fffcade0797 mach_msg + 55
2   com.apple.CoreFoundation        0x00007fffb553b434 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fffb553a8c1 __CFRunLoopRun + 1361
4   com.apple.CoreFoundation        0x00007fffb553a114 CFRunLoopRunSpecific + 420
5   com.apple.AppKit                0x00007fffb3180f02 _NSEventThread + 205
6   libsystem_pthread.dylib         0x00007fffcaed393b _pthread_body + 180
7   libsystem_pthread.dylib         0x00007fffcaed3887 _pthread_start + 286
8   libsystem_pthread.dylib         0x00007fffcaed308d thread_start + 13

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x000060000064b6a0  rbx: 0x0000000000000010  rcx: 0x00007fff5fa187e0  rdx: 0x0000608000437250
  rdi: 0x00007fa73de634e8  rsi: 0x00007fa73df002d0  rbp: 0x00007fff5fa18a90  rsp: 0x00007fff5fa186a0
   r8: 0x00007fff5fa187b0   r9: 0x00007fff5fa18838  r10: 0x000060800046d6c0  r11: 0x0000000000012068
  r12: 0x00007fa73de634e8  r13: 0x0000000000000002  r14: 0x00007fff5fa187b0  r15: 0x00007fff5fa18838
  rip: 0x0000000101a415b0  rfl: 0x0000000000010202  cr2: 0x0000000000000010

Logical CPU:     0
Error Code:      0x00000004
Trap Number:     14

Steps to reproduce

Export on a linux Host with the following settings:

[preset.2]

name="OSX"
platform="Mac OSX"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="export/osx/Anitya Demo.zip"
script_export_mode=1
script_encryption_key=""

[preset.2.options]

custom_template/debug=""
custom_template/release=""
application/name="Anitya Demo"
application/info="Anitya Demo"
application/icon="res://icon.png"
application/identifier="app.anitya"
application/signature=""
application/app_category="Games"
application/short_version="0.1"
application/version="0.1.0"
application/copyright="2022"
display/high_res=false
privacy/camera_usage_description=""
privacy/microphone_usage_description=""
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false

Minimal reproduction project

So far this happens only with out project. I managed before to export a MAC version but I am lost why this Project crashes with a segfault. I would need to check for access to debug things as this is comercial.

Calinou commented 2 years ago

Can you reproduce this if you export to a path that does not contain any spaces ("Anitya" instead of "Anitya Demo")?

akien-mga commented 2 years ago

If you're able to compile Godot from source (see instructions), you may be able to get a more informative backtrace for "Thread 0" where Godot itself is crashing. The official templates don't include debug symbols so we don't have the details, but a custom build would include them (unless you run strip on the binary, which reduces size by removing debug information).

Toasterson commented 2 years ago

It was unfortunately not spaces, a second project with spaces worked perfectly. We found some timeouts that where tiny and try to work with that. As we are Logging users in to the Multiplayer before we show an UI we think it is a bug in our code that shows like an engine bug rather than simply closing.

We are investigating atm and will report back. I hope we manage to reproduce. @akien-mga Thanks for the further hints! We will investigate those avenues aswell. Hopefully it's a bug in our code.