Repository: Azure-Samples/cognitive-services-speech-sdk

Issue #1555: EXC_BAD_ACCESS usp_reco_engine_adapter.cpp:2907
Created: 2022-06-29T03:40:49Z
Describe the bug
I received 3 crash reports, the crash reason is:
EXC_BAD_ACCESS: Attempted to dereference null pointer.
I have posted details stack trace in Additional context.
To Reproduce
Unknown, because we are unable to reach the end-user to ask details, we also unable to reproduce it on our devices.
Expected behavior
Version of the Cognitive Services Speech SDK

MicrosoftCognitiveServicesSpeech-iOS (1.19.0)

Platform, Operating System, and Programming Language

iOS 15.3.1
iPhone 13
Swift

Additional context
EXC_BAD_ACCESS: Attempted to dereference null pointer.
0  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::CSpxUspRecoEngineAdapter::OnTurnEnd(Microsoft::CognitiveServices::Speech::USP::TurnEndMsg const&) (usp_reco_engine_adapter.cpp:2907:26)
1  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::USP::CSpxUspCallbackWrapper::OnTurnEnd(Microsoft::CognitiveServices::Speech::USP::TurnEndMsg const&)::{lambda(std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::USP::ISpxUspCallbacks)#1}::operator()(std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::USP::ISpxUspCallbacks) const (usp.h:171:134)
2  MicrosoftCognitiveServicesSpeech _ZZN9Microsoft17CognitiveServices6Speech3USP10Connection4Impl15OnTransportDataEbRKNSt3__13mapINS5_12basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEESC_NS5_4lessISC_EENSA_INS5_4pairIKSC_SC_EEEEEEPKhmENK4$12clINS5_10shared_ptrINS2_9CallbacksEEEEEDaT (uspimpl.cpp:1380:57)
3  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::USP::Connection::Impl::Invoke(std::__1::function<void (std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::USP::Callbacks)>) (functional:1873:16)
4  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::USP::Connection::Impl::OnTransportData(bool, std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, unsigned char const*, unsigned long) (uspimpl.cpp:1380:17)
5  MicrosoftCognitiveServicesSpeech unsigned long Microsoft::CognitiveServices::Speech::Impl::event<std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&>::addMicrosoft::CognitiveServices::Speech::USP::Connection::Impl(std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::USP::Connection::Impl, void (Microsoft::CognitiveServices::Speech::USP::Connection::Impl::)(std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&))::{lambda(std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)#1}::operator()(std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const (event.h:44:21)
6  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::event<std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&>::raise(std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) (functional:1873:16)
7  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::USP::UspWebSocket::HandleTextData(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) (event.h:79:51)
8  MicrosoftCognitiveServicesSpeech unsigned long Microsoft::CognitiveServices::Speech::Impl::event<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&>::addMicrosoft::CognitiveServices::Speech::USP::UspWebSocket(std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::USP::UspWebSocket, void (Microsoft::CognitiveServices::Speech::USP::UspWebSocket::)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&))::{lambda(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)#1}::operator()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const (event.h:44:21)
9  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::event<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&>::raise(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) (functional:1873:16)
10 MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::CSpxWebSocket::OnWebSocketFrameReceived(unsigned char, unsigned char const*, unsigned long) (web_socket.cpp:937:17)
11 MicrosoftCognitiveServicesSpeech on_underlying_io_bytes_received (uws_client.c:1423:37)
12 MicrosoftCognitiveServicesSpeech dowork_read (tlsio_appleios.c:499:21)
13 MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::CSpxWebSocket::DoWork() (web_socket.cpp:748:9)
14 MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::CSpxWebSocket::WorkLoop(std::__1::weak_ptrMicrosoft::CognitiveServices::Speech::Impl::CSpxWebSocket)::$_9::operator()() const (web_socket.cpp:709:26)
15 MicrosoftCognitiveServicesSpeech std::__1::packaged_task<void ()>::operator()() (future:1993:12)
16 MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::CSpxThreadService::Task::Run() (thread_service.cpp:156:9)
17 MicrosoftCognitiveServicesSpeech void Microsoft::CognitiveServices::Speech::Impl::CSpxThreadService::Thread::RunTask<std::__1::pair<std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::Impl::CSpxThreadService::Task, std::__1::promise > >(std::__1::unique_lockstd::__1::mutex&, std::__1::deque<std::__1::pair<std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::Impl::CSpxThreadService::Task, std::__1::promise >, std::__1::allocator<std::__1::pair<std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::Impl::CSpxThreadService::Task, std::__1::promise > > >&) (thread_service.h:215:23)
18 MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::CSpxThreadService::Thread::WorkerLoop(std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::Impl::CSpxThreadService::Thread) (thread_service.cpp:325:27)
19 MicrosoftCognitiveServicesSpeech ZNSt3__1L8__invokeIPFvNS_10shared_ptrIN9Microsoft17CognitiveServices6Speech4Impl17CSpxThreadService6ThreadEEEEJS8_EEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOSB_DpOSC (type_traits:3545:1)
20 libsystem_pthread.dylib          __pthread_start

Duplicate issue #1589: Crash at EXC_BAD_ACCESS usp_reco_engine_adapter.cpp:2983
Created: 2022-07-23T23:15:10Z
Describe the bug
I received a crash reports, the crash reason is:
EXC_BAD_ACCESS: Attempted to dereference null pointer at usp_reco_engine_adapter.cpp:2983
I have posted details stack trace in Additional context.
To Reproduce
Unknown, it crashed after the session starting about 1900 seconds.
Expected behavior
Version of the Cognitive Services Speech SDK
MicrosoftCognitiveServicesSpeech-iOS (1.22.0)
Platform, Operating System, and Programming Language
iOS 15.5
iPhone 6S
Swift
Additional context
Exception Type:     EXC_BAD_ACCESS
Exception Subtype:  KERN_INVALID_ADDRESS
EXC_BAD_ACCESS: Attempted to dereference null pointer.
0  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::CSpxUspRecoEngineAdapter::OnTurnEnd(Microsoft::CognitiveServices::Speech::USP::TurnEndMsg const&) (usp_reco_engine_adapter.cpp:2983:26)
1  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::USP::CSpxUspCallbackWrapper::OnTurnEnd(Microsoft::CognitiveServices::Speech::USP::TurnEndMsg const&)::{lambda(std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::USP::ISpxUspCallbacks)#1}::operator()(std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::USP::ISpxUspCallbacks) const (usp_callbacks.h:158:134)
2  MicrosoftCognitiveServicesSpeech _ZZN9Microsoft17CognitiveServices6Speech3USP17CSpxUspConnection15OnTransportDataEbRKNSt3__13mapINS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEESB_NS4_4lessISB_EENS9_INS4_4pairIKSB_SB_EEEEEEPKhmENK4$12clINS4_10shared_ptrINS2_9CallbacksEEEEEDaT (usp_connection.cpp:1086:57)
3  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::USP::CSpxUspConnection::Invoke(std::__1::function<void (std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::USP::Callbacks)>) (functional:1885:16)
4  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::USP::CSpxUspConnection::OnTransportData(bool, std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, unsigned char const*, unsigned long) (usp_connection.cpp:1086:17)
5  MicrosoftCognitiveServicesSpeech unsigned long Microsoft::CognitiveServices::Speech::Impl::event<std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&>::addMicrosoft::CognitiveServices::Speech::USP::CSpxUspConnection(std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::USP::CSpxUspConnection, void (Microsoft::CognitiveServices::Speech::USP::CSpxUspConnection::)(std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&))::{lambda(std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)#1}::operator()(std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const (event.h:44:21)
6  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::event<std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&>::raise(std::__1::map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) (functional:1885:16)
7  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::USP::UspWebSocket::HandleTextData(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) (event.h:79:51)
8  MicrosoftCognitiveServicesSpeech unsigned long Microsoft::CognitiveServices::Speech::Impl::event<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&>::addMicrosoft::CognitiveServices::Speech::USP::UspWebSocket(std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::USP::UspWebSocket, void (Microsoft::CognitiveServices::Speech::USP::UspWebSocket::)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&))::{lambda(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)#1}::operator()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const (event.h:44:21)
9  MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::event<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&>::raise(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) (functional:1885:16)
10 MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::CSpxWebSocket::OnWebSocketFrameReceived(unsigned char, unsigned char const*, unsigned long) (web_socket.cpp:1004:17)
11 MicrosoftCognitiveServicesSpeech void Microsoft::CognitiveServices::Speech::Impl::CSpxWebSocket::cast_and_invoke<unsigned char, unsigned char const*, unsigned long>(void*, void (Microsoft::CognitiveServices::Speech::Impl::CSpxWebSocket::)(unsigned char, unsigned char const, unsigned long), unsigned char, unsigned char const*, unsigned long) (web_socket.h:129:25)
12 MicrosoftCognitiveServicesSpeech on_underlying_io_bytes_received (uws_client.c:1423:37)
13 MicrosoftCognitiveServicesSpeech dowork_read (tlsio_appleios.c:500:21)
14 MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::CSpxWebSocket::DoWork() (web_socket.cpp:809:22)
15 MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::CSpxWebSocket::WorkLoop(std::__1::weak_ptrMicrosoft::CognitiveServices::Speech::Impl::CSpxWebSocket)::$_8::operator()() const (web_socket.cpp:769:26)
16 MicrosoftCognitiveServicesSpeech std::__1::packaged_task<void ()>::operator()() (future:1866:12)
17 MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::CSpxThreadService::Task::Run() (thread_service.cpp:159:9)
18 MicrosoftCognitiveServicesSpeech void Microsoft::CognitiveServices::Speech::Impl::CSpxThreadService::Thread::RunTask<std::__1::pair<std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::Impl::CSpxThreadService::Task, std::__1::promise > >(std::__1::unique_lockstd::__1::mutex&, std::__1::deque<std::__1::pair<std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::Impl::CSpxThreadService::Task, std::__1::promise >, std::__1::allocator<std::__1::pair<std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::Impl::CSpxThreadService::Task, std::__1::promise > > >&) (thread_service.h:215:23)
19 MicrosoftCognitiveServicesSpeech Microsoft::CognitiveServices::Speech::Impl::CSpxThreadService::Thread::WorkerLoop(std::__1::shared_ptrMicrosoft::CognitiveServices::Speech::Impl::CSpxThreadService::Thread) (thread_service.cpp:328:27)
20 MicrosoftCognitiveServicesSpeech ZNSt3__1L8__invokeIPFvNS_10shared_ptrIN9Microsoft17CognitiveServices6Speech4Impl17CSpxThreadService6ThreadEEEEJS8_EEEDTclclsr3std3__1E7forwardIT_Efp_Espclsr3std3__1E7forwardIT0_Efp0_EEEOSB_DpOSC (type_traits:3694:1)
21 libsystem_pthread.dylib          __pthread_start

Closing comment (2022-07-25T19:03:21Z): This is likely the same as #1555, but with a newer version of the SDK.