Mono-OSX导致SIGSEGV

时间:2014-12-16 20:26:43

标签: c# macos mono xamarin steam

我最近开始将Steam API整合到游戏中。我在Windows和OSX上都有它。然后我开始整合统计数据,虽然这在Windows上运行良好,但在OSX上我突然出错了。即使完全禁用Steam代码也会出现以下错误。

snip 旧的堆栈跟踪:http://pastebin.com/qXtjmxU3

我无法追溯错误的来源。一旦我们合并了统计信息就会引入错误,但正如我所说:禁用代码也无法解决问题。我们还在同一时间添加了多线程资产加载,尽管这在错误开始出现之后略有增加。

我已经尝试重新安装单声道,禁用可能导致此问题的部分代码,但我真的不知道我应该在哪里开始寻找原因。

编辑:上面的堆栈跟踪来自我们加载的多线程资产导致的错误。修复后,这是Steam回调引起的实际错误。

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) Steamworks.NativeMethods.SteamAPI_RunCallbacks () <IL 0x00022, 0xffffffff>
  at Steamworks.SteamAPI.RunCallbacks () <IL 0x00005, 0x0002b>
  at BeardGame.Steam.SteamManager.Update () [0x00001] in /Users/Tom/dev/games/beardgame/src/Steam/SteamManager.cs:45
  at BeardGame.GameLoader.waitForSteam () [0x0002a] in /Users/Tom/dev/games/beardgame/src/GameLoader.cs:182
  at BeardGame.GameLoader.queueAll () [0x000eb] in /Users/Tom/dev/games/beardgame/src/GameLoader.cs:152
  at BeardGame.GameLoader.LoadAll () [0x0000f] in /Users/Tom/dev/games/beardgame/src/GameLoader.cs:58
  at BeardGame.TheGame.OnLoad (System.EventArgs) [0x00074] in /Users/Tom/dev/games/beardgame/src/TheGame.cs:140
  at amulware.Graphics.Program.OnLoadInternal (System.EventArgs) [0x00003] in /Users/Tom/dev/games/beardgame/libs/amulware.Graphics/src/amulware.Graphics/Program.cs:480
  at amulware.Graphics.Program.Run (double,double,double,bool) [0x00014] in /Users/Tom/dev/games/beardgame/libs/amulware.Graphics/src/amulware.Graphics/Program.cs:204
  at BeardGame.Program.Main () [0x00082] in /Users/Tom/dev/games/beardgame/src/Program.cs:41
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <IL 0x0004c, 0xffffffff>

Native stacktrace:


Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.GxKSf7'
Executing commands in '/private/tmp/mono-gdb-commands.GxKSf7'.
(lldb) process attach --pid 1931
Process 1931 stopped
Executable module set to "/Library/Frameworks/Mono.framework/Versions/3.10.0/bin/mono".
Architecture set to: i386-apple-macosx.
(lldb) thread list
Process 1931 stopped
* thread #1: tid = 0x85d4, 0x98eaae1a libsystem_kernel.dylib`__wait4 + 10, name = 'MainThrd', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x85d6, 0x98ea4a6a libsystem_kernel.dylib`semaphore_wait_trap + 10
  thread #3: tid = 0x85d7, 0x98eab8d2 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
  thread #4: tid = 0x85d8, 0x98eaa772 libsystem_kernel.dylib`__recvfrom + 10
  thread #5: tid = 0x85dc, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #6: tid = 0x85dd, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #7: tid = 0x85e1, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #8: tid = 0x85e2, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #9: tid = 0x85f3, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #10: tid = 0x8630, 0x98eaa516 libsystem_kernel.dylib`__psynch_cvwait + 10
  thread #11: tid = 0x8631, 0x98eaa516 libsystem_kernel.dylib`__psynch_cvwait + 10
  thread #12: tid = 0x8632, 0x98eab8b6 libsystem_kernel.dylib`kevent + 10, name = 'IOPollingHelperThread'
(lldb) thread backtrace all
* thread #1: tid = 0x85d4, 0x98eaae1a libsystem_kernel.dylib`__wait4 + 10, name = 'MainThrd', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x98eaae1a libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x95ce4b25 libsystem_c.dylib`waitpid$UNIX2003 + 48
    frame #2: 0x0017640d mono`mono_handle_native_sigsegv(signal=11, ctx=0x0076bfe0) + 541 at mini-exceptions.c:2323
    frame #3: 0x001c695b mono`mono_arch_handle_altstack_exception(sigctx=<unavailable>, fault_addr=<unavailable>, stack_ovf=0) + 155 at exceptions-x86.c:1159
    frame #4: 0x000c758d mono`mono_sigsegv_signal_handler(_dummy=<unavailable>, info=<unavailable>, context=<unavailable>) + 445 at mini.c:6861
    frame #5: 0x94e5503b libsystem_platform.dylib`_sigtramp + 43

  thread #2: tid = 0x85d6, 0x98ea4a6a libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #0: 0x98ea4a6a libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x0031cc9a mono`mono_sem_wait(sem=0x00422658, alertable=1) + 26 at mono-semaphore.c:103
    frame #2: 0x00288c3e mono`finalizer_thread(unused=0x00000000) + 142 at gc.c:1077
    frame #3: 0x00265c42 mono`start_wrapper [inlined] start_wrapper_internal + 485 at threads.c:660
    frame #4: 0x00265a5d mono`start_wrapper(data=<unavailable>) + 29 at threads.c:707
    frame #5: 0x00322060 mono`inner_start_thread(arg=<unavailable>) + 240 at mono-threads-posix.c:88
    frame #6: 0x9902becf libsystem_pthread.dylib`_pthread_body + 138
    frame #7: 0x9902be45 libsystem_pthread.dylib`_pthread_start + 162
    frame #8: 0x99029f0e libsystem_pthread.dylib`thread_start + 34

  thread #3: tid = 0x85d7, 0x98eab8d2 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x98eab8d2 libsystem_kernel.dylib`kevent64 + 10
    frame #1: 0x9304073f libdispatch.dylib`_dispatch_mgr_invoke + 245
    frame #2: 0x930403a2 libdispatch.dylib`_dispatch_mgr_thread + 52

  thread #4: tid = 0x85d8, 0x98eaa772 libsystem_kernel.dylib`__recvfrom + 10
    frame #0: 0x98eaa772 libsystem_kernel.dylib`__recvfrom + 10
    frame #1: 0x95ce4d32 libsystem_c.dylib`recv$UNIX2003 + 55
    frame #2: 0x001ae3e8 mono`socket_transport_recv(buf=<unavailable>, len=<unavailable>) + 168 at debugger-agent.c:1131
    frame #3: 0x001a04a7 mono`debugger_thread [inlined] transport_recv(len=<unavailable>) + 31 at debugger-agent.c:1557
    frame #4: 0x001a0488 mono`debugger_thread(arg=0x00000000) + 1560 at debugger-agent.c:9565
    frame #5: 0x00322060 mono`inner_start_thread(arg=<unavailable>) + 240 at mono-threads-posix.c:88
    frame #6: 0x9902becf libsystem_pthread.dylib`_pthread_body + 138
    frame #7: 0x9902be45 libsystem_pthread.dylib`_pthread_start + 162
    frame #8: 0x99029f0e libsystem_pthread.dylib`thread_start + 34

  thread #5: tid = 0x85dc, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x9902c36d libsystem_pthread.dylib`_pthread_wqthread + 939
    frame #2: 0x99029eea libsystem_pthread.dylib`start_wqthread + 30

  thread #6: tid = 0x85dd, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x9902c36d libsystem_pthread.dylib`_pthread_wqthread + 939
    frame #2: 0x99029eea libsystem_pthread.dylib`start_wqthread + 30

  thread #7: tid = 0x85e1, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x9902c36d libsystem_pthread.dylib`_pthread_wqthread + 939
    frame #2: 0x99029eea libsystem_pthread.dylib`start_wqthread + 30

  thread #8: tid = 0x85e2, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x9902c36d libsystem_pthread.dylib`_pthread_wqthread + 939
    frame #2: 0x99029eea libsystem_pthread.dylib`start_wqthread + 30

  thread #9: tid = 0x85f3, 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x98eaae6e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x9902c36d libsystem_pthread.dylib`_pthread_wqthread + 939
    frame #2: 0x99029eea libsystem_pthread.dylib`start_wqthread + 30

  thread #10: tid = 0x8630, 0x98eaa516 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x98eaa516 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x9902cb06 libsystem_pthread.dylib`_pthread_cond_wait + 726
    frame #2: 0x990301d1 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71
    frame #3: 0x002fc976 mono`_wapi_handle_timedwait_signal_handle(handle=<unavailable>, timeout=<unavailable>, alertable=<unavailable>, poll=<unavailable>) + 486 at handles.c:1595
    frame #4: 0x002fca28 mono`_wapi_handle_wait_signal_handle(handle=0x00001610, alertable=1) + 40 at handles.c:1540
    frame #5: 0x0030dfb7 mono`WaitForSingleObjectEx(handle=<unavailable>, timeout=<unavailable>, alertable=1) + 503 at wait.c:194
    frame #6: 0x002619a2 mono`ves_icall_System_Threading_WaitHandle_WaitOne_internal [inlined] mono_wait_uninterrupted(alertable=<unavailable>) + 34 at threads.c:1356
    frame #7: 0x00261980 mono`ves_icall_System_Threading_WaitHandle_WaitOne_internal(this=0x008d7c40, handle=<unavailable>, ms=-1, exitContext=0) + 80 at threads.c:1489
    frame #8: 0x068af1e8
    frame #9: 0x068b24f4
    frame #10: 0x068b23f3
    frame #11: 0x068b21fc
    frame #12: 0x068b1aa8
    frame #13: 0x068b1758
    frame #14: 0x068afc22
    frame #15: 0x068a8e14
    frame #16: 0x068a8d4e
    frame #17: 0x006dac49
    frame #18: 0x000c9d6f mono`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, exc=<unavailable>) + 751 at mini.c:6738
    frame #19: 0x0028b89f mono`mono_runtime_invoke(method=0x7b0dabd4, obj=0x008d67c8, params=<unavailable>, exc=<unavailable>) + 127 at object.c:2831
    frame #20: 0x00290d4c mono`mono_runtime_delegate_invoke(delegate=0x008d67c8, params=<unavailable>, exc=<unavailable>) + 92 at object.c:3542
    frame #21: 0x00265cc5 mono`start_wrapper [inlined] start_wrapper_internal + 616 at threads.c:666
    frame #22: 0x00265a5d mono`start_wrapper(data=<unavailable>) + 29 at threads.c:707
    frame #23: 0x00322060 mono`inner_start_thread(arg=<unavailable>) + 240 at mono-threads-posix.c:88
    frame #24: 0x9902becf libsystem_pthread.dylib`_pthread_body + 138
    frame #25: 0x9902be45 libsystem_pthread.dylib`_pthread_start + 162
    frame #26: 0x99029f0e libsystem_pthread.dylib`thread_start + 34

  thread #11: tid = 0x8631, 0x98eaa516 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x98eaa516 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x9902cb06 libsystem_pthread.dylib`_pthread_cond_wait + 726
    frame #2: 0x9903021d libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x002fc968 mono`_wapi_handle_timedwait_signal_handle [inlined] timedwait_signal_poll_cond(cond=0x79815458, mutex=0x7981542c, timeout=<unavailable>, alertable=<unavailable>) + 95 at handles.c:1500
    frame #4: 0x002fc909 mono`_wapi_handle_timedwait_signal_handle(handle=<unavailable>, timeout=0xb0724c10, alertable=<unavailable>, poll=<unavailable>) + 377 at handles.c:1590
    frame #5: 0x0030dfd4 mono`WaitForSingleObjectEx(handle=<unavailable>, timeout=<unavailable>, alertable=<unavailable>) + 532 at wait.c:196
    frame #6: 0x002619a2 mono`ves_icall_System_Threading_WaitHandle_WaitOne_internal [inlined] mono_wait_uninterrupted(alertable=<unavailable>) + 34 at threads.c:1356
    frame #7: 0x00261980 mono`ves_icall_System_Threading_WaitHandle_WaitOne_internal(this=0x008d89c8, handle=<unavailable>, ms=-1, exitContext=0) + 80 at threads.c:1489
    frame #8: 0x068af1e8
    frame #9: 0x068ae9e8
    frame #10: 0x068ac140
    frame #11: 0x068a9954
    frame #12: 0x068a914c
    frame #13: 0x068a8ed0
    frame #14: 0x068a8e00
    frame #15: 0x068a8d4e
    frame #16: 0x006dac49
    frame #17: 0x000c9d6f mono`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, exc=<unavailable>) + 751 at mini.c:6738
    frame #18: 0x0028b89f mono`mono_runtime_invoke(method=0x7b0dabd4, obj=0x008d6928, params=<unavailable>, exc=<unavailable>) + 127 at object.c:2831
    frame #19: 0x00290d4c mono`mono_runtime_delegate_invoke(delegate=0x008d6928, params=<unavailable>, exc=<unavailable>) + 92 at object.c:3542
    frame #20: 0x00265cc5 mono`start_wrapper [inlined] start_wrapper_internal + 616 at threads.c:666
    frame #21: 0x00265a5d mono`start_wrapper(data=<unavailable>) + 29 at threads.c:707
    frame #22: 0x00322060 mono`inner_start_thread(arg=<unavailable>) + 240 at mono-threads-posix.c:88
    frame #23: 0x9902becf libsystem_pthread.dylib`_pthread_body + 138
    frame #24: 0x9902be45 libsystem_pthread.dylib`_pthread_start + 162
    frame #25: 0x99029f0e libsystem_pthread.dylib`thread_start + 34

  thread #12: tid = 0x8632, 0x98eab8b6 libsystem_kernel.dylib`kevent + 10, name = 'IOPollingHelperThread'
    frame #0: 0x98eab8b6 libsystem_kernel.dylib`kevent + 10
    frame #1: 0x072be27e steamclient.dylib`OSXHelpers::CIOPollingHelper::RealRun() + 286
    frame #2: 0x0838da9d libtier0_s.dylib`CatchAndWriteContext_t::Invoke() + 159
    frame #3: 0x0838d49f libtier0_s.dylib`CatchAndWriteMiniDump_Impl(CatchAndWriteContext_t&) + 214
    frame #4: 0x0838d586 libtier0_s.dylib`CatchAndWriteMiniDumpExForVoidPtrFn + 87
    frame #5: 0x0838d5af libtier0_s.dylib`CatchAndWriteMiniDumpForVoidPtrFn + 35
    frame #6: 0x072be14f steamclient.dylib`OSXHelpers::CIOPollingHelper::Run() + 41
    frame #7: 0x08392030 libtier0_s.dylib`SteamThreadTools::CThread::ThreadExceptionWrapper(void*) + 16
    frame #8: 0x0838da9d libtier0_s.dylib`CatchAndWriteContext_t::Invoke() + 159
    frame #9: 0x0838d49f libtier0_s.dylib`CatchAndWriteMiniDump_Impl(CatchAndWriteContext_t&) + 214
    frame #10: 0x0838d586 libtier0_s.dylib`CatchAndWriteMiniDumpExForVoidPtrFn + 87
    frame #11: 0x0838d5af libtier0_s.dylib`CatchAndWriteMiniDumpForVoidPtrFn + 35
    frame #12: 0x08391fa4 libtier0_s.dylib`SteamThreadTools::CThread::ThreadProc(void*) + 238
    frame #13: 0x9902becf libsystem_pthread.dylib`_pthread_body + 138
    frame #14: 0x9902be45 libsystem_pthread.dylib`_pthread_start + 162
    frame #15: 0x99029f0e libsystem_pthread.dylib`thread_start + 34
(lldb) detach

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Process 1931 detached
(lldb) quit

1 个答案:

答案 0 :(得分:0)

TL; DR:托管代码名为glGenBuffers,然后崩溃。

更长的解释:我的猜测是,这与多线程资产加载有关,因为崩溃看起来与OpenGL有关:

thread #9: tid = 0x16e17, 0x9c34ae1a libsystem_kernel.dylib __wait4 + 10  
     [...]
     frame #5: 0x91e0a03b libsystem_platform.dylib _sigtramp + 43  
     frame #6: 0x9a345a33 libGL.dylib glGenBuffers + 21  
     frame #7: 0x06a14f3c <unknown managed frame>