hi, we’re making a mobile game use astarpathfindproject with gridgraph and rvo simulator on ios/android. both pathfinding request and rvo simulator use multiple thread. there’s a issue my teamates found on ios that is kill the game manuelly when playing. the tester found if in battle which use pathfinding request and rvo simulator, the ios will report a crash but if the battle end(no more pathfinging request and rvo simulator) the game quit normally. it should be caused by multithreading. while in ios you shouldn’t write exit code in onapplicationquit() but should use onapplicationpause().(android and unity editor works normally)
so any hint or advice to do with this issue?
thanks.
Hi
Do you have some error logs or anything I could use?
I’m not quite sure what the pathfinding threads would be doing wrong.
usually, the thread works well. the only issue is when you kill the game when use ios home button to suspend curent game, and then kill the process, it will report a exception.
after the error dialog show, i check the ios crash.log,it looks like this
Date/Time: 2021-03-07 22:18:41.661 +0800
End time: 2021-03-07 22:20:35.669 +0800
OS Version: iPhone OS 14.3 (Build 18C66)
Architecture: arm64
Report Version: 32
Incident Identifier: 2094E20B-6AAB-4AAF-949B-2A515CEB8DB1
Data Source: Microstackshots
Shared Cache: D106C550-CDFC-3D17-B014-8D75508D64A7 slid base address 0x181958000, slide 0x1958000
Command: apple
Path: /private/var/containers/Bundle/Application/52ECD24F-6F1D-4FE5-8E67-3457B48590D5/apple.app/apple
Identifier: com.elex.twdsaw.apple
Version: 0.9.2 (134)
Adam ID: 1514546586
Is First Party: No
Is Beta: Yes
Cohort: 2|date=1615125600000&sf=143465&tid=ba79a1875c3d2a99cc4206e8fcf44d0ba99661990384e9e021cf99f793b6d275&ttype=i
Beta Identifier: 6933FED0-D7AD-47D8-BE97-1669CA17B635
PID: 2089
Event: wakeups
Action taken: none
Wakeups: 45001 wakeups over the last 114 seconds (395 wakeups per second average), exceeding limit of 150 wakeups per second over 300 seconds
Wakeups limit: 45000
Limit duration: 300s
Wakeups caused: 45001
Wakeups duration: 114s
Duration: 114.01s
Duration Sampled: 92.68s
Steps: 18
Hardware model: iPhone10,2
Active cpus: 6
Heaviest stack for the target process:
10 ??? (libsystem_pthread.dylib + 39740) [0x1ca4f9b3c]
4 ??? (apple + 16180996) [0x10363e704]
3 ??? (apple + 16136548) [0x103633964]
3 ??? (apple + 15741844) [0x1035d3394]
3 ??? (apple + 16109016) [0x10362cdd8]
3 ??? (apple + 16113116) [0x10362dddc]
3 ??? (apple + 16123652) [0x103630704]
3 ??? (apple + 15776904) [0x1035dbc88]
3 ??? (apple + 16256132) [0x103650c84]
3 ??? (apple + 15776904) [0x1035dbc88]
2 ??? (apple + 16286996) [0x103658514]
2 ??? (apple + 16270568) [0x1036544e8]
1 ??? (apple + 16278344) [0x103656348]
1 ??? (apple + 16279036) [0x1036565fc]
Powerstats for: apple [2089]
UUID: 6BEADF7B-54DD-33BB-8D90-09A1C1D8FA06
Adam ID: 1514546586
Is First Party: No
Is Beta: Yes
Cohort: 2|date=1615125600000&sf=143465&tid=ba79a1875c3d2a99cc4206e8fcf44d0ba99661990384e9e021cf99f793b6d275&ttype=i
Beta Identifier: 6933FED0-D7AD-47D8-BE97-1669CA17B635
App Version: 0.9.2
Build Version: 134
Path: /private/var/containers/Bundle/Application/52ECD24F-6F1D-4FE5-8E67-3457B48590D5/apple.app/apple
Architecture: arm64
Footprint: 475.30 MB
Pageins: 8 pages
Start time: 2021-03-07 22:18:59.342 +0800
End time: 2021-03-07 22:20:32.018 +0800
Num samples: 18 (100%)
Primary state: 7 samples Frontmost App, Non-Suppressed, User mode, Effective Thread QoS Unspecified, Requested Thread QoS Unspecified, Override Thread QoS Unspecified
User Activity: 0 samples Idle, 18 samples Active
Power Source: 18 samples on Battery, 0 samples on AC
10 _pthread_start + 287 (libsystem_pthread.dylib + 39740) [0x1ca4f9b3c]
4 FMOD::callback + 87 (apple + 16180996) [0x10363e704]
3 FMOD::SystemI::updateStreams + 159 (apple + 16136548) [0x103633964]
3 FMOD::ChannelStream::updateStream + 507 (apple + 15741844) [0x1035d3394]
3 FMOD::Stream::fill + 1275 (apple + 16109016) [0x10362cdd8]
3 FMOD::SoundI::read + 747 (apple + 16113116) [0x10362dddc]
3 FMOD::SoundI::readData + 415 (apple + 16123652) [0x103630704]
3 FMOD::Codec::read + 291 (apple + 15776904) [0x1035dbc88]
3 FMOD::CodecFSB5::readInternal + 343 (apple + 16256132) [0x103650c84]
3 FMOD::Codec::read + 291 (apple + 15776904) [0x1035dbc88]
2 FMOD::CodecVorbis::readInternal + 267 (apple + 16286996) [0x103658514]
2 fmod_tremor_dsp_synthesis + 307 (apple + 16270568) [0x1036544e8]
1 fmod_tremor_mapping_inverse + 955 (apple + 16278344) [0x103656348]
1 fmod_tremor_mdct_backward + 612 (apple + 16279036) [0x1036565fc]
1 fmod_tremor_mapping_inverse + 599 (apple + 16277988) [0x1036561e4]
1 fmod_tremor_res_inverse + 911 (apple + 16282952) [0x103657548]
1 fmod_tremor_book_decodevv_add + 139 (apple + 16268400) [0x103653c70]
1 decode_map + 55 (apple + 16267588) [0x103653944]
1 decode_packed_entry_number + 84 (apple + 16266932) [0x1036536b4]
1 FMOD::CodecVorbis::readInternal + 147 (apple + 16286876) [0x10365849c]
1 fmod_tremor_dsp_lapout + 392 (apple + 16269056) [0x103653f00]
1 FMOD::OutputCoreAudio::updateMixer + 91 (apple + 16076372) [0x103624e54]
1 FMOD::Output::mix + 679 (apple + 16069552) [0x1036233b0]
1 FMOD::DSPSoundCard::read + 87 (apple + 16012204) [0x1036153ac]
1 FMOD::DSPFilter::read + 303 (apple + 15945576) [0x103604f68]
1 FMOD::DSPFilter::read + 303 (apple + 15945576) [0x103604f68]
1 FMOD::DSPFilter::read + 303 (apple + 15945576) [0x103604f68]
1 FMOD::DSPFilter::read + 303 (apple + 15945576) [0x103604f68]
1 FMOD::DSPFilter::read + 303 (apple + 15945576) [0x103604f68]
1 FMOD::DSPFilter::read + 303 (apple + 15945576) [0x103604f68]
1 FMOD::DSPFilter::read + 755 (apple + 15946028) [0x10360512c]
1 FMOD::DSPConnectionI::mix + 472 (apple + 16214500) [0x1036469e4]
2 FMOD::callback + 43 (apple + 16180952) [0x10363e6d8]
2 FMOD_OS_Time_Sleep + 19 (apple + 16062216) [0x103621708]
2 usleep + 63 (libsystem_c.dylib + 460204) [0x18aab15ac]
1 nanosleep + 211 (libsystem_c.dylib + 460500) [0x18aab16d4]
1 __semwait_signal + 23 (libsystem_kernel.dylib + 162816) [0x1adc9dc00]
1 _pthread_exit_if_canceled + 0 (libsystem_pthread.dylib + 49936) [0x1ca4fc310]
1 DYLD-STUB$$-[CIImage imageBySettingPropertiesNoCopy:].cold.1 + 0 (CoreImage + 2402632) [0x189c3d948]
2 Thread::RunThreadWrapper (Thread.cpp:76) (Thread.cpp:76 in apple + 9961376) [0x10304ffa0]
2 JobQueue::WorkLoop (JobQueue.cpp:960) (JobQueue.cpp:960 in apple + 9441448) [0x102fd10a8]
1 JobQueue::ProcessJobs (JobQueue.cpp:911) (JobQueue.cpp:911 in apple + 9444404) [0x102fd1c34]
1 CappedSemaphore::WaitForSignal (CappedSemaphore.h:66) (CappedSemaphore.h:66 in apple + 9193336) [0x102f94778]
1 _dispatch_semaphore_wait_slow + 127 (libdispatch.dylib + 205320) [0x1819d0208]
1 semaphore_wait_trap + 8 (libsystem_kernel.dylib + 18048) [0x1adc7a680]
1 <Kernel mode, Effective Thread QoS Default, Requested Thread QoS Default>
1 JobQueue::ProcessJobs (JobQueue.cpp:887) (JobQueue.cpp:887 in apple + 9444312) [0x102fd1bd8]
1 JobQueue::ExecuteJobFromHighPriorityStack (JobQueue.cpp:803) (JobQueue.cpp:803 in apple + 9443980) [0x102fd1a8c]
1 JobQueue::Exec (JobQueue.cpp:557) (JobQueue.cpp:557 in apple + 9443148) [0x102fd174c]
1 physx::NpScene::SceneCompletion::release (NpScene.h:455) (NpScene.h:455 in apple + 13523448) [0x1033b59f8]
1 physx::shdfnd::SyncImpl::set (PsUnixSync.cpp:115) (PsUnixSync.cpp:115 in apple + 15280816) [0x103562ab0]
1 pthread_cond_broadcast$VARIANT$armv81 + 744 (libsystem_pthread.dylib + 24828) [0x1ca4f60fc]
1 <Effective Thread QoS Default, Requested Thread QoS Default>
1 void* caulk::thread_proxy<std::__1::tuple<caulk::attributes, AURemoteIO::IOThread::IOThread::‘lambda’(), std::__1::tuple<> > >(void*) + 599 (libEmbeddedSystemAUs.dylib + 616440) [0x1b1bc17f8]
1 MSHMIGDispatchMessage + 35 (libAudioToolboxUtility.dylib + 71180) [0x19685960c]
1 mshMIGPerform + 263 (libAudioToolboxUtility.dylib + 70140) [0x1968591fc]
1 _XPerformIO + 128 (libEmbeddedSystemAUs.dylib + 929832) [0x1b1c0e028]
1 il2cpp::os::ThreadImpl::ThreadStartWrapper (ThreadImpl.cpp:104) (ThreadImpl.cpp:104 in apple + 16561356) [0x10369b4cc]
1 il2cpp::os::RunWrapper (Thread.cpp:173) (Thread.cpp:173 in apple + 16552740) [0x103699324]
1 il2cpp::icalls::mscorlib::System::Threading::ThreadStart (Thread.cpp:158) (Thread.cpp:158 in apple + 16521652) [0x1036919b4]
1 il2cpp::vm::Runtime::Invoke (Runtime.cpp:531) (Runtime.cpp:531 in apple + 16710004) [0x1036bf974]
1 RuntimeInvoker_TrueVoid_tDB81A15FA2AB53E2401A76B745D215397B29F783(), MethodInfo const*, void*, void**) (Il2CppInvokerTable.cpp:65641) (Il2CppInvokerTable.cpp:65641 in apple + 2196428) [0x1028e83cc]
1 GraphUpdateProcessor_ProcessGraphUpdatesAsync_mEF2EB992B57AC6D38408743CDC45F13D8E5EA962 (Bulk_AstarPathfindingProject_2.cpp:19226 in apple + 48766796) [0x105551f4c]
1 il2cpp::icalls::mscorlib::System::Threading::WaitHandle::WaitAny_internal (WaitHandle.cpp:44) (WaitHandle.cpp:44 in apple + 16523244) [0x103691fec]
1 il2cpp::os::Handle::WaitAny (Handle.cpp:26) (Handle.cpp:26 in apple + 16556264) [0x10369a0e8]
1 il2cpp::os::posix::PosixWaitObject::Wait (PosixWaitObject.cpp:157) (PosixWaitObject.cpp:157 in apple + 16586004) [0x1036a1514]
1 __psynch_cvwait + 8 (libsystem_kernel.dylib + 161308) [0x1adc9d61c]
1 <Kernel mode, Effective Thread QoS Default, Requested Thread QoS Default>
8 start + 3 (libdyld.dylib + 5480) [0x181a1e568]
8 main (main.mm:41 in apple + 17936) [0x1026d4610]
8 UIApplicationMain + 163 (UIKitCore + 11745624) [0x184634958]
8 -[UIApplication _run] + 1051 (UIKitCore + 11723736) [0x18462f3d8]
8 GSEventRunModal + 159 (GraphicsServices + 13720) [0x198a7d598]
8 CFRunLoopRunSpecific + 571 (CoreFoundation + 605088) [0x181d3fba0]
5 __CFRunLoopRun + 1175 (CoreFoundation + 607600) [0x181d40570]
5 __CFRunLoopServiceMachPort + 375 (CoreFoundation + 631036) [0x181d460fc]
5 mach_msg_trap + 8 (libsystem_kernel.dylib + 17988) [0x1adc7a644]
5 <Kernel mode, Effective Thread QoS User Interactive, Requested Thread QoS User Interactive>
2 __CFRunLoopRun + 2331 (CoreFoundation + 608756) [0x181d409f4]
2 __CFRunLoopDoSource1 + 587 (CoreFoundation + 632884) [0x181d46834]
2 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 55 (CoreFoundation + 635936) [0x181d47420]
2 __CFMachPortPerform + 171 (CoreFoundation + 490324) [0x181d23b54]
2 display_timer_callback + 275 (QuartzCore + 941572) [0x184fcee04]
1 os_unfair_lock_unlock$VARIANT$armv81 + 24 (libsystem_platform.dylib + 24300) [0x1ca4e9eec]
1 <Effective Thread QoS User Interactive, Requested Thread QoS User Interactive>
1 CA::Display::DisplayLink::dispatch_items + 659 (QuartzCore + 80100) [0x184efc8e4]
1 -[UnityAppController repaintDisplayLink] (UnityAppController+Rendering.mm:71) (UnityAppController+Rendering.mm:71 in apple + 51360) [0x1026dc8a0]
1 UnityRepaint (UnityAppController+Rendering.mm:277 in apple + 51652) [0x1026dc9c4]
1 UnityPlayerLoopImpl (LibEntryPoint.mm:272) (LibEntryPoint.mm:272 in apple + 12422968) [0x1032a8f38]
1 PlayerLoop (PlayerLoop.cpp:418) (PlayerLoop.cpp:418 in apple + 9653232) [0x103004bf0]
1 ExecutePlayerLoop (PlayerLoop.cpp:364) (PlayerLoop.cpp:364 in apple + 9652752) [0x103004a10]
1 ExecutePlayerLoop (PlayerLoop.cpp:347) (PlayerLoop.cpp:347 in apple + 9652700) [0x1030049dc]
1 PlayerRender (Player.cpp:899) (Player.cpp:899 in apple + 9665520) [0x103007bf0]
1 RenderManager::RenderCameras()) (RenderManager.cpp:289) (RenderManager.cpp:289 in apple + 8391960) [0x102ed0d18]
1 Camera::CustomRender()) (Camera.cpp:3017) (Camera.cpp:3017 in apple + 8364208) [0x102eca0b0]
1 Camera::DoRender (Camera.cpp:1939) (Camera.cpp:1939 in apple + 8360352) [0x102ec91a0]
1 DoRenderLoop (RenderLoopPrivate.cpp:521) (RenderLoopPrivate.cpp:521 in apple + 8669916) [0x102f14adc]
1 RenderImageFilters (RenderLoopPrivate.cpp:180) (RenderLoopPrivate.cpp:180 in apple + 8667520) [0x102f14180]
1 Camera::SetupRender (Camera.cpp:661) (Camera.cpp:661 in apple + 8346492) [0x102ec5b7c]
1 Camera::SetupRender (Camera.cpp:688) (Camera.cpp:688 in apple + 8346668) [0x102ec5c2c]
1 Camera::SetRenderTargetAndViewport (Camera.cpp:4467) (Camera.cpp:4467 in apple + 8347072) [0x102ec5dc0]
1 Camera::ApplyRenderTexture (Camera.cpp:4458) (Camera.cpp:4458 in apple + 8374032) [0x102ecc710]
1 RenderTexture::SetActive (RenderTexture.cpp:157) (RenderTexture.cpp:157 in apple + 8939504) [0x102f567f0]
1 RenderTexture::SetActive (RenderTexture.cpp:226) (RenderTexture.cpp:226 in apple + 8937820) [0x102f5615c]
1 _platform_memmove + 244 (libsystem_platform.dylib + 29140) [0x1ca4eb1d4]
1 <Effective Thread QoS User Interactive, Requested Thread QoS User Interactive>
1 __CFRunLoopRun + 2411 (CoreFoundation + 608836) [0x181d40a44]
1 __CFRunLoopModeIsEmpty + 72 (CoreFoundation + 604252) [0x181d3f85c]
1 <Effective Thread QoS User Interactive, Requested Thread QoS User Interactive>
Binary Images:
0x1026d0000 - ??? com.elex.twdsaw.apple 0.9.2 (134) <6BEADF7B-54DD-33BB-8D90-09A1C1D8FA06> /private/var/containers/Bundle/Application/52ECD24F-6F1D-4FE5-8E67-3457B48590D5/apple.app/apple
0x18199e000 - 0x181a1cfff libdispatch.dylib <04B54A98-8EAD-371E-8C12-AD116CB118E2> /usr/lib/system/libdispatch.dylib
0x181a1d000 - 0x181a53fff libdyld.dylib /usr/lib/system/libdyld.dylib
0x181cac000 - 0x182055fff CoreFoundation <6FD5304A-9759-3E22-A863-456EAB55F4CC> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x183b01000 - 0x184ecafff UIKitCore <3405666F-F281-3F71-BA86-83E5A27AB5B0> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x184ee9000 - 0x18515efff QuartzCore /System/Library/Frameworks/QuartzCore.framework/QuartzCore
0x1899f3000 - 0x189cf2fff CoreImage /System/Library/Frameworks/CoreImage.framework/CoreImage
0x18aa41000 - 0x18aabdfff libsystem_c.dylib /usr/lib/system/libsystem_c.dylib
0x196848000 - 0x19687afff libAudioToolboxUtility.dylib <5E1F6BCB-B9B4-3B5E-8C11-05F1B8BDB4DB> /usr/lib/libAudioToolboxUtility.dylib
0x198a7a000 - 0x198a82fff GraphicsServices <74274083-05FA-31B3-A3F1-1216855C910A> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x1adc76000 - 0x1adca6fff libsystem_kernel.dylib <70F0BF28-5A58-32C7-B85E-ED47A2216291> /usr/lib/system/libsystem_kernel.dylib
0x1b1b2b000 - 0x1b1c3cfff libEmbeddedSystemAUs.dylib <622E670D-C03B-3542-A69B-B6F06C8F2713> /System/Library/Frameworks/AudioToolbox.framework/libEmbeddedSystemAUs.dylib
0x1ca4e4000 - 0x1ca4eefff libsystem_platform.dylib <2B25322B-286E-3302-9D09-0CD510D369B4> /usr/lib/system/libsystem_platform.dylib
0x1ca4f0000 - 0x1ca500fff libsystem_pthread.dylib /usr/lib/system/libsystem_pthread.dylib
hard to find any useful information except a GraphUpdateProcessor_ProcessGraphUpdatesAsync.
i’m trying to add function on xxxxBehavior :: OnapplicationQuit. Can you provide a safe method to kill all the pathfindg request and rvo simulator’s thread?
Hmm, you can always try to load a new empty scene before quitting the game. Maybe that will work around the issue?