cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.28k stars 7.05k forks source link

audio crash in version 3.15 #18794

Open wzx110113627 opened 6 years ago

wzx110113627 commented 6 years ago

my app build on cocos2d-x lua 3.15 . from bugly ,I find a lot of crash in audio system. crash have 2 different stack:


type A: 0 libsystem_platform.dylib _platform_memmove + 176 1 OpenAL OALSource::DoRender(AudioBufferList, unsigned int) + 2380 2 OpenAL OALSource::DoRender(AudioBufferList, unsigned int) + 2380 3 OpenAL OALSource::SourceInputProc(void, unsigned int, AudioTimeStamp const, unsigned int, unsigned int, AudioBufferList) + 60 4 AudioToolbox AUSpatialMixer::Render(unsigned int&, AudioTimeStamp const&, unsigned int) + 1772 5 AudioToolbox AUBase::DoRenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, AUOutputElement, unsigned int, AudioBufferList&) + 172 6 AudioToolbox AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) + 492 7 AudioToolbox AUMethodRender(void, unsigned int, AudioTimeStamp const, unsigned int, unsigned int, AudioBufferList) + 44 8 AudioToolbox AUConverterBase::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 324 9 AudioToolbox AURemoteIO::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 156 10 AudioToolbox AUBase::DoRenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, AUOutputElement, unsigned int, AudioBufferList&) + 172 11 AudioToolbox AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) + 492 12 AudioToolbox AURemoteIO::PerformIO(unsigned int, unsigned int, unsigned int, AudioTimeStamp const&, AudioTimeStamp const&, AudioBufferList const, AudioBufferList, int&) + 744 13 AudioToolbox _AURIOCallbackReceiver_PerformIO + 356 14 AudioToolbox __XPerformIO + 104 15 AudioToolbox _mshMIGPerform + 232 16 AudioToolbox _MSHMIGDispatchMessage + 40 17 AudioToolbox AURemoteIO::IOThread::Run() + 284 18 AudioToolbox AURemoteIO::IOThread::Entry(void) + 156 19 AudioToolboxCAPThread::Entry(CAPThread) + 88

and devices type and system version list :

iPhone x 11.3 (15E216) iPhone 6s Plus 11.3 (15E216) iPhone 6s Plus 11.2.5 (15D60) iPhone 7 Plus 11.3 (15E216) iPad 5th generation 11.3 (15E216) iPhone 6 11.3 (15E216) iPhone 7 Plus 11.3 (15E216) iPhone 6 11.3 (15E216) iPhone 6 11.3 (15E216) iPad Pro 10.5-inch 11.3 (15E216)

and so on.


type B: 0 AudioToolbox _CrashIfClientProvidedBogusAudioBufferList + 56 1 AudioToolbox AudioConverterConvertComplexBuffer + 868 2 AudioToolbox AUSpatialMixer::Render(unsigned int&, AudioTimeStamp const&, unsigned int) + 2048 3 AudioToolbox AUBase::DoRenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, AUOutputElement, unsigned int, AudioBufferList&) + 172 4 AudioToolbox AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) + 492 5 AudioToolbox AUMethodRender(void, unsigned int, AudioTimeStamp const, unsigned int, unsigned int, AudioBufferList) + 44 6 AudioToolbox AUInputElement::PullInput(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 140 7 AudioToolbox AUInputFormatConverter2::InputProc(OpaqueAudioConverter, unsigned int, AudioBufferList, AudioStreamPacketDescription*, void) + 220 8 AudioToolbox AudioConverterChain::CallInputProc(unsigned int) + 640 9 AudioToolbox AudioConverterChain::FillBufferFromInputProc(unsigned int, CABufferList) + 128 10 AudioToolbox BufferedAudioConverter::GetInputBytes(unsigned int, unsigned int&, CABufferList const&) + 192 11 AudioToolbox Resampler2Wrapper::RenderOutput(CABufferList, unsigned int, unsigned int&) + 192 12 AudioToolbox SampleRateConverter::RenderOutput(CABufferList, unsigned int, unsigned int&, AudioStreamPacketDescription) + 48 13 AudioToolbox BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription) + 804 14 AudioToolbox AudioConverterChain::RenderOutput(CABufferList, unsigned int, unsigned int&, AudioStreamPacketDescription) + 120 15 AudioToolbox BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription) + 804 16 AudioToolbox AudioConverterFillComplexBuffer + 964 17 AudioToolbox AUConverterBase::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 632 18 AudioToolbox AURemoteIO::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 156 19 AudioToolbox AUBase::DoRenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, AUOutputElement, unsigned int, AudioBufferList&) + 172 20 AudioToolbox AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) + 492 21 AudioToolbox AURemoteIO::PerformIO(unsigned int, unsigned int, unsigned int, AudioTimeStamp const&, AudioTimeStamp const&, AudioBufferList const, AudioBufferList, int&) + 744 22 AudioToolbox _AURIOCallbackReceiver_PerformIO + 356 23 AudioToolbox __XPerformIO + 104 24 AudioToolbox _mshMIGPerform + 232 25 AudioToolbox _MSHMIGDispatchMessage + 40 26 AudioToolbox AURemoteIO::IOThread::Run() + 284 27 AudioToolbox AURemoteIO::IOThread::Entry(void) + 156 28 AudioToolbox CAPThread::Entry(CAPThread*) + 88 29 libsystem_pthread.dylib pthread_body + 272 30 libsystem_pthread.dylib pthread_body

and devices type and system version list : iPhone x 11.3 (15E216) iPhone x 11.2 (15C114) iPhone 7 11.3 (15E216) iPad Pro 10.5-inch 11.3 (15E216) iPhone 6s 11.1.1 (15B150) iPhone 7 Plus 11.3 (15E216) iPad Air 11.3 (15E216) iPad mini 2 11.3 (15E216) iPhone 6s 11.3 (15E216) ipad7,5 11.3 (15E216)

this crash happend aboult 10000 times from app version 1.0.0 to 1.4.0 in one year.


by the way ,When these crash occurs ,most users have enter to background for a period of time and return back. bellow is one of users action history:

04-27 15:09:23.371 UIApplication DidFinishLaunching

204-27 15:09:23.608 UIApplication DidBecomeActive 304-27 15:10:13.273 UIApplication WillResignActive 404-27 15:10:14.091 UIApplication DidBecomeActive 504-27 15:10:24.620 UIApplication WillResignActive 604-27 15:10:25.500 UIApplication DidBecomeActive 704-27 15:10:26.246 UIApplication WillResignActive 804-27 15:10:26.965 UIApplication DidBecomeActive 904-27 15:10:26.987 UIApplication WillResignActive 1004-27 15:10:30.299 UIApplication DidBecomeActive 1104-27 15:10:31.014 UIApplication WillResignActive 1204-27 15:10:32.141 UIApplication DidEnterBackground 1304-27 15:10:32.389 UIApplication WillEnterForeground 1404-27 15:10:32.693 UIApplication DidBecomeActive

dumganhar said: Fixed at #17500 and #17518 . the code has merged to my engine version. but help nothing.

thanks

drelaptop commented 6 years ago

how to reproduce it, any simple code?

wzx110113627 commented 6 years ago

@drelaptop I wish I can reproduce,but i can not . the crash messages is from bugly. I have no idea to fix it,so I feedback here.

drelaptop commented 6 years ago

thanks for feedback, hope any other developers know the reason.

tjudemon commented 6 years ago

Also the same problem. Almost on ios 11. Everyday thousands of crashs are almost there of below. I used cocos3.3, but never occured until ios 11 came out.

Bugly crash stack1:

0 AudioToolbox _CrashIfClientProvidedBogusAudioBufferList + 56
1 AudioToolbox AudioConverterConvertComplexBuffer + 920
2 AudioToolbox AUSpatialMixer::Render(unsigned int&, AudioTimeStamp const&, unsigned int) + 1652
3 AudioToolbox AUBase::DoRenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, AUOutputElement*, unsigned int, AudioBufferList&) + 172
4 AudioToolbox AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) + 948
5 AudioToolbox AUMethodRender(void, unsigned int, AudioTimeStamp const, unsigned int, unsigned int, AudioBufferList) + 44
6 AudioToolbox AUInputElement::PullInput(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 140
7 AudioToolbox AUInputFormatConverter2::InputProc(OpaqueAudioConverter, unsigned int, AudioBufferList*, AudioStreamPacketDescription*, void) + 220
8 AudioToolbox AudioConverterChain::CallInputProc(unsigned int) + 596
9 AudioToolbox AudioConverterChain::FillBufferFromInputProc(unsigned int, CABufferList) + 128
10 AudioToolbox BufferedAudioConverter::GetInputBytes(unsigned int, unsigned int&, CABufferList const*&) + 192
11 AudioToolbox CBRConverter::RenderOutput(CABufferList, unsigned int, unsigned int&, AudioStreamPacketDescription) + 120
12 AudioToolbox BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 800
13 AudioToolbox AudioConverterChain::RenderOutput(CABufferList, unsigned int, unsigned int&, AudioStreamPacketDescription) +120
14 AudioToolbox BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 800
15 AudioToolbox AudioConverterFillComplexBuffer + 1048
16 AudioToolbox AUConverterBase::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 640
17 AudioToolbox AURemoteIO::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 104
18 AudioToolbox AUBase::DoRenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, AUOutputElement*, unsigned int, AudioBufferList&) + 172
19 AudioToolbox AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) + 948
20 AudioToolbox AURemoteIO::PerformIO(unsigned int, unsigned int, unsigned int, AudioTimeStamp const&, AudioTimeStamp const&, AudioBufferList const, AudioBufferList, int&) + 756
21 AudioToolbox _AURIOCallbackReceiver_PerformIO + 356
22 AudioToolbox __XPerformIO + 104
23 AudioToolbox _mshMIGPerform + 232
24 AudioToolbox _MSHMIGDispatchMessage + 36
25 AudioToolbox AURemoteIO::IOThread::Run() + 288
26 AudioToolbox AURemoteIO::IOThread::Entry(void*) + 160
27 AudioToolbox CAPThread::Entry(CAPThread*) + 84
28 libsystem_pthread.dylib __pthread_body + 308
29 libsystem_pthread.dylib __pthread_body

Bugly crash stack2:

0 libsystem_platform.dylib _platform_memmove + 176
1 OpenAL OALSource::DoRender(AudioBufferList*, unsigned int) + 2380
2 OpenAL OALSource::DoRender(AudioBufferList*, unsigned int) + 2380
3 OpenAL OALSource::SourceInputProc(void, unsigned int, AudioTimeStamp const, unsigned int, unsigned int, AudioBufferList) + 60
4 AudioToolbox AUSpatialMixer::Render(unsigned int&, AudioTimeStamp const&, unsigned int) + 1772
5 AudioToolbox AUBase::DoRenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, AUOutputElement*, unsigned int, AudioBufferList&) + 172
6 AudioToolbox AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) + 492
7 AudioToolbox AUMethodRender(void, unsigned int, AudioTimeStamp const, unsigned int, unsigned int, AudioBufferList) + 44
8 AudioToolbox AUConverterBase::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 324
9 AudioToolbox AURemoteIO::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 156
10 AudioToolbox AUBase::DoRenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, AUOutputElement*, unsigned int, AudioBufferList&) + 172
11 AudioToolbox AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) + 492
12 AudioToolbox AURemoteIO::PerformIO(unsigned int, unsigned int, unsigned int, AudioTimeStamp const&, AudioTimeStamp const&, AudioBufferList const, AudioBufferList, int&) + 744
13 AudioToolbox _AURIOCallbackReceiver_PerformIO + 356
14 AudioToolbox __XPerformIO + 104
15 AudioToolbox _mshMIGPerform + 232
16 AudioToolbox _MSHMIGDispatchMessage + 40
17 AudioToolbox AURemoteIO::IOThread::Run() + 284
18 AudioToolbox AURemoteIO::IOThread::Entry(void*) + 156
19 AudioToolbox CAPThread::Entry(CAPThread*) + 88
20 libsystem_pthread.dylib __pthread_body + 272
21 libsystem_pthread.dylib __pthread_body

Bugly crash stack3:

0 libsystem_kernel.dylib __pthread_kill + 8
1 libsystem_pthread.dylib _pthread_kill$VARIANT$mp + 376
2 libsystem_c.dylib abort + 140
3 libc++abi.dylib __cxa_bad_cast + 0
4 libc++abi.dylib default_terminate_handler() + 280
5 libobjc.A.dylib _objc_terminate() + 140
6 libc++abi.dylib std::__terminate(void (*)()) + 16
7 libc++abi.dylib __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
8 libc++.1.dylib std::1::throw_system_error(int, char const*) + 88
9 libc++.1.dylib std::__1::mutex::try_lock() + 0
10 Modernship_iOS_China_Release cocos2d::experimental::AudioCache::invokingCallbacks() + 36
11 Modernship_iOS_China_Release cocos2d::experimental::AudioCache::readDataTask() + 556
12 Modernship_iOS_China_Release cocos2d::experimental::AudioEngineThreadPool::threadFunc(int) + 132
13 Modernship_iOS_China_Release void std::1::thread_proxy<std::1::tuple<std::1::unique_ptr<std::1::thread_struct, std::1::default_delete >, std::1::__bind<void (cocos2d::experimental::AudioEngineThreadPool::)(int), cocos2d::experimental::AudioEngineThreadPool, int&> > >(void) + 72
14 libsystem_pthread.dylib __pthread_body + 272
15 libsystem_pthread.dylib __pthread_body
guilhemvors commented 6 years ago

this is the same bug as this one (I gave a more detailed explanation there):

https://github.com/cocos2d/cocos2d-x/issues/18948