Crash on gui spine animation complete (SOLVED)

So I have a 100% crash on a GUI spine animation.
I have mocked up a testversion if you would like to have and also narrowed the crash down to a specific condition.
If playing first an animation with a complete function and then playing another animation without complete function defined it will crash.

-- CRASH  when first clicking key_2 and then key_1.
function on_input(self, action_id, action)
    	if action_id == hash("key_1") and action.pressed == true then
    		gui.play_spine_anim(self.spine, "anim_in", gui.PLAYBACK_ONCE_FORWARD)
    	elseif action_id == hash("key_2") and action.pressed == true then
    		gui.play_spine_anim(self.spine, "anim_out", gui.PLAYBACK_ONCE_FORWARD, {}, function() print("completed") end)
    	end
    end

-- NO CRASH  key_1 animation has a complete function as well.
function on_input(self, action_id, action)
    	if action_id == hash("key_1") and action.pressed == true then
    		gui.play_spine_anim(self.spine, "anim_in", gui.PLAYBACK_ONCE_FORWARD, {} function()end)
    	elseif action_id == hash("key_2") and action.pressed == true then
    		gui.play_spine_anim(self.spine, "anim_out", gui.PLAYBACK_ONCE_FORWARD, {}, function() print("completed") end)
    	end
    end

Need full log? Just shout (or replicate the crash, it’s quite easy)

LOG
Process: dmengine [26155]
Path: /Applications/Defold/*/dmengine
Identifier: dmengine
Version: ???
Code Type: X86 (Native)
Parent Process: Defold [25279]
Responsible: dmengine [26155]
User ID: 501

Date/Time: 2017-04-16 12:04:05.786 +0200
OS Version: Mac OS X 10.11.6 (15G1217)
Report Version: 11
Anonymous UUID: 493EDFAA-3219-B705-4E83-B52B22267877

Sleep/Wake UUID: 3C2609B5-2E5C-4E51-8405-EB53A3E1F3BB

Time Awake Since Boot: 120000 seconds
Time Since Wake: 1500 seconds

System Integrity Protection: enabled

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

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information:
Assertion failed: (lua_type(L, -3) == LUA_TFUNCTION), function LuaAnimationComplete, file …/src/gui_script.cpp, line 580.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x9583f572 __pthread_kill + 10
1 libsystem_pthread.dylib 0x94e25654 pthread_kill + 101
2 libsystem_c.dylib 0x9a54cc38 abort + 156
3 libsystem_c.dylib 0x9a514ff9 __assert_rtn + 393
4 dmengine 0x0025f8f8 dmGui::LuaAnimationComplete(dmGui::Scene*, unsigned int, bool, void*, void*) + 360
5 dmengine 0x0025749a dmGui::RigEventCallback(dmRig::RigEventType, void*, void*, void*) + 58
6 dmengine 0x001abadb dmRig::UpdatePlayer(dmRig::RigInstance*, dmRig::RigPlayer*, float, float) + 603
7 dmengine 0x001a5485 dmRig::Update(dmRig::RigContext*, float) + 1093
8 dmengine 0x00019362 dmGameObject::Update(dmGameObject::Collection*, dmGameObject::UpdateContext const*) + 930
9 dmengine 0x000385a1 dmGameSystem::CompCollectionProxyUpdate(dmGameObject::ComponentsUpdateParams const&) + 305
10 dmengine 0x0001927b dmGameObject::Update(dmGameObject::Collection*, dmGameObject::UpdateContext const*) + 699
11 dmengine 0x00005171 dmEngine::Step(dmEngine::Engine*) + 1537
12 dmengine 0x00066d05 dmGraphics::RunApplicationLoop(void*, void ()(void), int ()(void)) + 37
13 dmengine 0x00005e7e dmEngine::InitRun(dmEngineService::EngineService*, int, char**, void ()(dmEngine::Engine, void*), void ()(dmEngine::Engine, void*), void*) + 190
14 dmengine 0x00005cf4 dmEngine::Launch(int, char**, void ()(dmEngine::Engine, void*), void ()(dmEngine::Engine, void*), void*) + 100
15 dmengine 0x00005fee engine_main(int, char**) + 142
16 dmengine 0x00001ec5 start + 53

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x958407fa kevent_qos + 10
1 libdispatch.dylib 0x9968f7ea _dispatch_mgr_invoke + 234
2 libdispatch.dylib 0x9968f3be _dispatch_mgr_thread + 52

Thread 2:: log
0 libsystem_kernel.dylib 0x9583f7ce __semwait_signal + 10
1 libsystem_c.dylib 0x9a56c8d1 nanosleep$UNIX2003 + 218
2 libsystem_c.dylib 0x9a56c77d usleep$UNIX2003 + 60
3 dmengine 0x001de09c dmLogThread(void*) + 380
4 dmengine 0x001f0828 dmThread::ThreadStartProxy(void*) + 40
5 libsystem_pthread.dylib 0x94e22780 _pthread_body + 138
6 libsystem_pthread.dylib 0x94e226f6 _pthread_start + 155
7 libsystem_pthread.dylib 0x94e1ff7a thread_start + 34

Thread 3:
0 libsystem_kernel.dylib 0x9583fd5e __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x94e2234b _pthread_wqthread + 1289
2 libsystem_pthread.dylib 0x94e1ff56 start_wqthread + 34

Thread 4:
0 libsystem_kernel.dylib 0x9583fd5e __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x94e2234b _pthread_wqthread + 1289
2 libsystem_pthread.dylib 0x94e1ff56 start_wqthread + 34

Thread 5:: CVDisplayLink
0 libsystem_kernel.dylib 0x9583f3ea __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x94e235a7 _pthread_cond_wait + 868
2 libsystem_pthread.dylib 0x94e248b1 pthread_cond_timedwait_relative_np + 47
3 com.apple.CoreVideo 0x9e02cb9d CVDisplayLink::waitUntil(unsigned long long) + 285
4 com.apple.CoreVideo 0x9e02c910 CVDisplayLink::runIOThread() + 678
5 com.apple.CoreVideo 0x9e02c2bb startIOThread(void*) + 159
6 libsystem_pthread.dylib 0x94e22780 _pthread_body + 138
7 libsystem_pthread.dylib 0x94e226f6 _pthread_start + 155
8 libsystem_pthread.dylib 0x94e1ff7a thread_start + 34

Thread 6:: http
0 libsystem_kernel.dylib 0x9583f3ea __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x94e23538 _pthread_cond_wait + 757
2 libsystem_pthread.dylib 0x94e25276 pthread_cond_wait$UNIX2003 + 71
3 dmengine 0x001ba11f dmConditionVariable::Wait(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 31
4 dmengine 0x001e0817 dmMessage::InternalDispatch(unsigned int, void ()(dmMessage::Message, void*), void*, bool) + 343
5 dmengine 0x001e09b7 dmMessage::DispatchBlocking(unsigned int, void ()(dmMessage::Message, void*), void*) + 39
6 dmengine 0x00113816 dmHttpService::Loop(void*) + 86
7 dmengine 0x001f0828 dmThread::ThreadStartProxy(void*) + 40
8 libsystem_pthread.dylib 0x94e22780 _pthread_body + 138
9 libsystem_pthread.dylib 0x94e226f6 _pthread_start + 155
10 libsystem_pthread.dylib 0x94e1ff7a thread_start + 34

Thread 7:: http
0 libsystem_kernel.dylib 0x9583f3ea __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x94e23538 _pthread_cond_wait + 757
2 libsystem_pthread.dylib 0x94e25276 pthread_cond_wait$UNIX2003 + 71
3 dmengine 0x001ba11f dmConditionVariable::Wait(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 31
4 dmengine 0x001e0817 dmMessage::InternalDispatch(unsigned int, void ()(dmMessage::Message, void*), void*, bool) + 343
5 dmengine 0x001e09b7 dmMessage::DispatchBlocking(unsigned int, void ()(dmMessage::Message, void*), void*) + 39
6 dmengine 0x00113816 dmHttpService::Loop(void*) + 86
7 dmengine 0x001f0828 dmThread::ThreadStartProxy(void*) + 40
8 libsystem_pthread.dylib 0x94e22780 _pthread_body + 138
9 libsystem_pthread.dylib 0x94e226f6 _pthread_start + 155
10 libsystem_pthread.dylib 0x94e1ff7a thread_start + 34

Thread 8:: http
0 libsystem_kernel.dylib 0x9583f3ea __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x94e23538 _pthread_cond_wait + 757
2 libsystem_pthread.dylib 0x94e25276 pthread_cond_wait$UNIX2003 + 71
3 dmengine 0x001ba11f dmConditionVariable::Wait(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 31
4 dmengine 0x001e0817 dmMessage::InternalDispatch(unsigned int, void ()(dmMessage::Message, void*), void*, bool) + 343
5 dmengine 0x001e09b7 dmMessage::DispatchBlocking(unsigned int, void ()(dmMessage::Message, void*), void*) + 39
6 dmengine 0x00113816 dmHttpService::Loop(void*) + 86
7 dmengine 0x001f0828 dmThread::ThreadStartProxy(void*) + 40
8 libsystem_pthread.dylib 0x94e22780 _pthread_body + 138
9 libsystem_pthread.dylib 0x94e226f6 _pthread_start + 155
10 libsystem_pthread.dylib 0x94e1ff7a thread_start + 34

Thread 9:: http
0 libsystem_kernel.dylib 0x9583f3ea __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x94e23538 _pthread_cond_wait + 757
2 libsystem_pthread.dylib 0x94e25276 pthread_cond_wait$UNIX2003 + 71
3 dmengine 0x001ba11f dmConditionVariable::Wait(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 31
4 dmengine 0x001e0817 dmMessage::InternalDispatch(unsigned int, void ()(dmMessage::Message, void*), void*, bool) + 343
5 dmengine 0x001e09b7 dmMessage::DispatchBlocking(unsigned int, void ()(dmMessage::Message, void*), void*) + 39
6 dmengine 0x00113816 dmHttpService::Loop(void*) + 86
7 dmengine 0x001f0828 dmThread::ThreadStartProxy(void*) + 40
8 libsystem_pthread.dylib 0x94e22780 _pthread_body + 138
9 libsystem_pthread.dylib 0x94e226f6 _pthread_start + 155
10 libsystem_pthread.dylib 0x94e1ff7a thread_start + 34

Thread 10:: http_balance
0 libsystem_kernel.dylib 0x9583f3ea __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x94e23538 _pthread_cond_wait + 757
2 libsystem_pthread.dylib 0x94e25276 pthread_cond_wait$UNIX2003 + 71
3 dmengine 0x001ba11f dmConditionVariable::Wait(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 31
4 dmengine 0x001e0817 dmMessage::InternalDispatch(unsigned int, void ()(dmMessage::Message, void*), void*, bool) + 343
5 dmengine 0x001e09b7 dmMessage::DispatchBlocking(unsigned int, void ()(dmMessage::Message, void*), void*) + 39
6 dmengine 0x00113da3 dmHttpService::LoadBalancer(void*) + 51
7 dmengine 0x001f0828 dmThread::ThreadStartProxy(void*) + 40
8 libsystem_pthread.dylib 0x94e22780 _pthread_body + 138
9 libsystem_pthread.dylib 0x94e226f6 _pthread_start + 155
10 libsystem_pthread.dylib 0x94e1ff7a thread_start + 34

Thread 11:: com.apple.audio.IOThread.client
0 libsystem_kernel.dylib 0x9583849a mach_msg_trap + 10
1 libsystem_kernel.dylib 0x95837884 mach_msg + 68
2 com.apple.audio.CoreAudio 0x9289f8ac HALB_MachPort::SendMessageWithReply(unsigned int, unsigned int, unsigned long, unsigned long, mach_msg_header_t*, bool, unsigned int) + 140
3 com.apple.audio.CoreAudio 0x92898ab2 HALB_MachPort::SendSimpleMessageWithSimpleReply(unsigned int, unsigned int, int, int&, bool, unsigned int) + 72
4 com.apple.audio.CoreAudio 0x92896f20 HALC_ProxyIOContext::IOWorkLoop() + 1392
5 com.apple.audio.CoreAudio 0x92896894 HALC_ProxyIOContext::IOThreadEntry(void*) + 156
6 com.apple.audio.CoreAudio 0x928a29ec ___ZN19HALC_ProxyIOContextC2Emj_block_invoke + 20
7 com.apple.audio.CoreAudio 0x928967b9 HALB_IOThread::Entry(void*) + 71
8 libsystem_pthread.dylib 0x94e22780 _pthread_body + 138
9 libsystem_pthread.dylib 0x94e226f6 _pthread_start + 155
10 libsystem_pthread.dylib 0x94e1ff7a thread_start + 34

Thread 12:: com.apple.NSEventThread
0 libsystem_kernel.dylib 0x9583849a mach_msg_trap + 10
1 libsystem_kernel.dylib 0x95837884 mach_msg + 68
2 com.apple.CoreFoundation 0x9503ed16 __CFRunLoopServiceMachPort + 214
3 com.apple.CoreFoundation 0x9503e121 __CFRunLoopRun + 1521
4 com.apple.CoreFoundation 0x9503d8c6 CFRunLoopRunSpecific + 390
5 com.apple.CoreFoundation 0x9503d72b CFRunLoopRunInMode + 123
6 com.apple.AppKit 0x9c133dde _NSEventThread + 291
7 libsystem_pthread.dylib 0x94e22780 _pthread_body + 138
8 libsystem_pthread.dylib 0x94e226f6 _pthread_start + 155
9 libsystem_pthread.dylib 0x94e1ff7a thread_start + 34

Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x00000000 ebx: 0x002f8aa2 ecx: 0xbffff30c edx: 0x00000000
edi: 0xa333d000 esi: 0x00000006 ebp: 0xbffff328 esp: 0xbffff30c
ss: 0x00000023 efl: 0x00000206 eip: 0x9583f572 cs: 0x0000000b
ds: 0x00000023 es: 0x00000023 fs: 0x00000000 gs: 0x0000000f
cr2: 0xa3898a10

Logical CPU: 0
Error Code: 0x00080148
Trap Number: 132

2 Likes

Thank you for reporting this! I’ll create a ticket on Tuesday when I’m back at the office. @Johan_Beck-Noren has been working with the spine animations recently. He might know more.

Created ticket: DEF-2647

1 Like

Great repro case! A fix for this should be in the 1.2.103 release :slight_smile:

3 Likes

This has been fixed in release 1.2.103!

4 Likes