Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C-API unit tests occasionally crashing on CI env. #969

Open
lalitb opened this issue Dec 1, 2021 · 2 comments
Open

C-API unit tests occasionally crashing on CI env. #969

lalitb opened this issue Dec 1, 2021 · 2 comments
Assignees
Labels
bug Something isn't working iOS iOS related issue

Comments

@lalitb
Copy link
Contributor

lalitb commented Dec 1, 2021

Once such instance: https://github.com/microsoft/cpp_client_telemetry/runs/4257958450?check_suite_focus=true

Similar crashes are reported by projects trying to integrate using CAPI. One such crash dump:

#0  0x80fd9ff2 in mipns::DoTaskDispatcherQueue(evt_task_t*, void (*)(char const*))::$_1::operator()() const (
    this=0xb79a9584) at src/core/api_impl/diagnostic/oneds/oneds_impl.cpp:186
#1  0x80fd9db3 in std::__ndk1::__invoke<mipns::DoTaskDispatcherQueue(evt_task_t*, void (*)(char const*))::$_1&> (__f=...)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/type_traits:3874
#2  0x80fd9d73 in std::__ndk1::__invoke_void_return_wrapper<void>::__call<mipns::DoTaskDispatcherQueue(evt_task_t*, void (*)(char const*))::$_1&>(mipns::DoTaskDispatcherQueue(evt_task_t*, void (*)(char const*))::$_1&) (__args=...)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/__functional_base:348
#3  0x80fd9d13 in std::__ndk1::__function::__alloc_func<mipns::DoTaskDispatcherQueue(evt_task_t*, void (*)(char const*))::$_1, std::__ndk1::allocator<mipns::DoTaskDispatcherQueue(evt_task_t*, void (*)(char const*))::$_1>, void ()>::operator()()
    (this=0xb79a9584)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/functional:1557
#4  0x80fd9bef in std::__ndk1::__function::__func<mipns::DoTaskDispatcherQueue(evt_task_t*, void (*)(char const*))::$_1, std::__ndk1::allocator<mipns::DoTaskDispatcherQueue(evt_task_t*, void (*)(char const*))::$_1>, void ()>::operator()() (
    this=0xb79a9580)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/functional:1731
#5  0x80e9443f in std::__ndk1::__function::__value_func<void ()>::operator()() const (this=0xb7802818)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/functional:1884
#6  0x80e943fc in std::__ndk1::function<void ()>::operator()() const (this=0xb7802818)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/functional:2556
#7  0x80ea8012 in mipns::EventLoopTimed::RunLoop (this=0xb7a21720) at src/base/event_loop_timed.cpp:167
#8  0x80ea8b31 in std::__ndk1::__invoke<void (mipns::EventLoopTimed::*)(), mipns::EventLoopTimed*, , void> (
    __f=@0xb7a7ba94: (void (mipns::EventLoopTimed::*)(mipns::EventLoopTimed * const)) 0x81e58a48 <mipns::EventLoopTimed::RunLoop()>, __a0=@0xb7a7ba9c: 0xb7a21720)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/type_traits:3815
#9  0x80ea89f0 in std::__ndk1::__thread_execute<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_delete<std::__ndk1::__thread_struct> >, void (mipns::EventLoopTimed::*)(), mipns::EventLoopTimed*, 2u> (__t=...)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/thread:273
#10 0x80ea8718 in std::__ndk1::__thread_proxy<std::__ndk1::tuple<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_delete<std::__ndk1::__thread_struct> >, void (mipns::EventLoopTimed::*)(), mipns::EventLoopTimed*> > (
    __vp=0xb7a7ba90)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/thread:284
#11 0xb7d409b6 in __pthread_start(void*) () from target:/system/lib/libc.so
#12 0xb7cf050c in __start_thread () from target:/system/lib/libc.so
#13 0xb7ceeda7 in __bionic_clone () from target:/system/lib/libc.so


#0  0xb7edaac4 in __kernel_vsyscall ()
#1  0xb7d44ce8 in nanosleep () from target:/system/lib/libc.so
#2  0xb7bcd62a in std::__ndk1::__libcpp_thread_sleep_for (__ns=...)
    at /Volumes/Android/buildbot/src/android/ndk-release-r22/toolchain/llvm-project/libcxx/include/__threading_support:502
#3  std::__ndk1::this_thread::sleep_for (ns=...)
    at /Volumes/Android/buildbot/src/android/ndk-release-r22/toolchain/llvm-project/libcxx/src/thread.cpp:122
#4  0x80bf34f9 in std::__ndk1::this_thread::sleep_for<long long, std::__ndk1::ratio<1ll, 1000ll> > (__d=...)
    at /Users/viherasi/android/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/thread:385
#5  0x80bf339d in Microsoft::Applications::Events::PlatformAbstraction::PlatformAbstractionLayer::sleep (
    this=0x81eb3ec0 <Microsoft::Applications::Events::PlatformAbstraction::GetPAL()::pal>, delayMs=100) at /Users/viherasi/cpp_client_telemetry/lib/pal/PAL.cpp:72
#6  0x80c98335 in Microsoft::Applications::Events::PlatformAbstraction::sleep (
    delayMs=100) at /Users/viherasi/cpp_client_telemetry/lib/pal/PAL.hpp:128
#7  0x80c982f6 in Microsoft::Applications::Events::sleep (delayMs=100)
    at /Users/viherasi/cpp_client_telemetry/lib/utils/Utils.cpp:45
#8  0x80c2e2d8 in Microsoft::Applications::Events::TelemetrySystem::TelemetrySystem(Microsoft::Applications::Events::ILogManager&, Microsoft::Applications::Events::IRuntimeConfig&, Microsoft::Applications::Events::IOfflineStorage&, Microsoft::Applications::Events::IHttpClient&, Microsoft::Applications::Events::ITaskDispatcher&, Microsoft::Applications::Events::IBandwidthController*, Microsoft::Applications::Events::LogSessionDataProvider&)::$_1::operator()() const (this=0xb791b37c)
    at /Users/viherasi/cpp_client_telemetry/lib/system/TelemetrySystem.cpp:83
#9  0x80c2e0e4 in std::__ndk1::__invoke<Microsoft::Applications::Events::TelemetrySystem::TelemetrySystem(Microsoft::Applications::Events::ILogManager&, Microsoft::Applic--Type <RET> for more, q to quit, c to continue without paging--
ations::Events::IRuntimeConfig&, Microsoft::Applications::Events::IOfflineStorage&, Microsoft::Applications::Events::IHttpClient&, Microsoft::Applications::Events::ITaskDispatcher&, Microsoft::Applications::Events::IBandwidthController*, Microsoft::Applications::Events::LogSessionDataProvider&)::$_1&> (__f=...)
    at /Users/viherasi/android/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/type_traits:3874
#10 0x80c2e074 in std::__ndk1::__invoke_void_return_wrapper<bool>::__call<Microsoft::Applications::Events::TelemetrySystem::TelemetrySystem(Microsoft::Applications::Events::ILogManager&, Microsoft::Applications::Events::IRuntimeConfig&, Microsoft::Applications::Events::IOfflineStorage&, Microsoft::Applications::Events::IHttpClient&, Microsoft::Applications::Events::ITaskDispatcher&, Microsoft::Applications::Events::IBandwidthController*, Microsoft::Applications::Events::LogSessionDataProvider&)::$_1&>(Microsoft::Applications::Events::TelemetrySystem::TelemetrySystem(Microsoft::Applications::Events::ILogManager&, Microsoft::Applications::Events::IRuntimeConfig&, Microsoft::Applications::Events::IOfflineStorage&, Microsoft::Applications::Events::IHttpClient&, Microsoft::Applications::Events::ITaskDispatcher&, Microsoft::Applications::Events::IBandwidthController*, Microsoft::Applications::Events::LogSessionDataProvider&)::$_1&) (__args=...)
    at /Users/viherasi/android/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/__functional_base:317
#11 0x80c2e034 in std::__ndk1::__function::__alloc_func<Microsoft::Applications::Events::TelemetrySystem::TelemetrySystem(Microsoft::Applications::Events::ILogManager&, Microsoft::Applications::Events::IRuntimeConfig&, Microsoft::Applications::Events::IOfflineStorage&, Microsoft::Applications::Events::IHttpClient&, Microsoft::Applications::Events::ITaskDispatcher&, Microsoft::Applications::Events::IBandwidthController*, Microsoft::Applications::Events::LogSessionDataProvider&)::$_1, std::__ndk1::allocator<Microsoft::Applications::Events::TelemetrySystem::TelemetrySystem(Microsoft::Applications::Events::ILogManager&, Microsoft::Applications::Events::IRuntimeConfig&, Microsoft::Applications::Events::IOfflineStorage&, Microsoft::Applications::Events::IHttpClient&, Microsoft::Applications::Events::ITaskDispatcher&, Microsoft::Applications::Events::IBandwidthController*, Microsoft::Applications::Events::LogSessionDataProvider&)::$_1>, bool ()>::operator()() (
    this=0xb791b37c)
    at /Users/viherasi/android/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/functional:1557
#12 0x80c2ca49 in std::__ndk1::__function::__func<Microsoft::Applications::Events::TelemetrySystem::TelemetrySystem(Microsoft::Applications::Events::ILogManager&, Microsoft::Applications::Events::IRuntimeConfig&, Microsoft::Applications::Events::IOfflineStorage&, Microsoft::Applications::Events::IHttpClient&, Microsoft::Applications::Events::ITaskDispatcher&, Microsoft::Applications::Events::IBandwidthController*, Microsoft::Applications::Events::LogSessionDataProvider&)::$_1, std::__ndk1::allocator<Microsoft::Applications::Events::TelemetrySystem::TelemetrySystem(Microsoft::Applications::Events::ILogManager&, Microsoft::Applications::Events::IRuntimeConfig&, Microsoft::Applications::Events::IOfflineStorage&, Microsoft::Applications::Events::IHttpClient&, Microsoft::Applications::Events::ITaskDispatcher&, Microsoft::Applications::Events::IBandwidthController*, Microsoft::Applications::Events::LogSessionDataProvider&)::$_1>, bool ()>::operator()() (this=0xb791b378)
    at /Users/viherasi/android/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/functional:1731
#13 0x8104792d in std::__ndk1::__function::__value_func<bool ()>::operator()() const (this=0xb791b378)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/functional:1884
#14 0x810478ef in std::__ndk1::function<bool ()>::operator()() const (this=0xb791b378)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/functional:2556
#15 0x80c1b1a8 in Microsoft::Applications::Events::TelemetrySystemBase::stop (this=0xb791b000)
--Type <RET> for more, q to quit, c to continue without paging--
    at /Users/viherasi/cpp_client_telemetry/lib/system/TelemetrySystemBase.hpp:65
#16 0x80b47854 in Microsoft::Applications::Events::LogManagerImpl::FlushAndTeardown (this=0xb798f900)
    at /Users/viherasi/cpp_client_telemetry/lib/api/LogManagerImpl.cpp:393
#17 0x80b4709a in Microsoft::Applications::Events::LogManagerImpl::~LogManagerImpl (this=0xb798f900)
    at /Users/viherasi/cpp_client_telemetry/lib/api/LogManagerImpl.cpp:355
#18 0x80b47bfc in Microsoft::Applications::Events::LogManagerImpl::~LogManagerImpl (this=0xb798f900)
    at /Users/viherasi/cpp_client_telemetry/lib/api/LogManagerImpl.cpp:354
#19 0x80b3a456 in Microsoft::Applications::Events::LogManagerFactory::Destroy (instance=0xb798f900)
    at /Users/viherasi/cpp_client_telemetry/lib/api/LogManagerFactory.cpp:58
#20 0x80b3bebe in Microsoft::Applications::Events::LogManagerFactory::release (
    this=0x81eb3d98 <Microsoft::Applications::Events::LogManagerFactory::instance()::impl>, name=..., host=...)
    at /Users/viherasi/cpp_client_telemetry/lib/api/LogManagerFactory.cpp:200
#21 0x80b3bd88 in Microsoft::Applications::Events::LogManagerFactory::release (
    this=0x81eb3d98 <Microsoft::Applications::Events::LogManagerFactory::instance()::impl>, c=...)
    at /Users/viherasi/cpp_client_telemetry/lib/api/LogManagerFactory.cpp:169
#22 0x80b37cc5 in Microsoft::Applications::Events::LogManagerFactory::Release (config=...)
    at /Users/viherasi/cpp_client_telemetry/lib/api/LogManagerFactory.hpp:129
#23 0x80b37c86 in Microsoft::Applications::Events::LogManagerProvider::Release (config=...)
    at /Users/viherasi/cpp_client_telemetry/lib/api/LogManagerProvider.cpp:44
#24 0x80b27ca4 in mat_close (ctx=0xbffff000) at /Users/viherasi/cpp_client_telemetry/lib/api/capi.cpp:290
#25 0x80b24ae2 in evt_api_call_default (ctx=0xbffff000) at /Users/viherasi/cpp_client_telemetry/lib/api/capi.cpp:369
#26 0x80fd146e in evt_close (handle=3331318513) at packages/Microsoft.MIP.Telemetry/include/mat.h:464
#27 0x80fd11f1 in mipns::OneDSHelper::~OneDSHelper (this=0xb79887ac)
    at src/core/api_impl/diagnostic/oneds/oneds_helper.cpp:184
#28 0x80f53c87 in std::__ndk1::__shared_ptr_emplace<mipns::OneDSHelper, std::__ndk1::allocator<mipns::OneDSHelper> >::__on_zero_shared (this=0xb79887a0)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/memory:3668
#29 0x80e854d4 in std::__ndk1::__shared_count::__release_shared (this=0xb79887a0)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/memory:3506
#30 0x80e85482 in std::__ndk1::__shared_weak_count::__release_shared (this=0xb79887a0)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/memory:3548
#31 0x80f15fea in std::__ndk1::shared_ptr<mipns::OneDSAriaHelper>::~shared_ptr (this=0xb79a9510)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/memory:4248
#32 0x80f51d6f in mipns::OneDSAuditDelegate::~OneDSAuditDelegate (this=0xb79a950c)
    at src/core/api_impl/diagnostic/oneds/oneds_audit_delegate.h:20
#33 0x80f51c17 in std::__ndk1::__shared_ptr_emplace<mipns::OneDSAuditDelegate, std::__ndk1::allocator<mipns::OneDSAuditDelegate> >::__on_zero_shared (this=0xb79a9500)
    at /Users/viherasi/android/sdk_ndk/ndk/22.1.7171670/toolchains/llvm/prebuilt/darwin-x86_64/bin/../sysroot/usr/include/c++/v1/memory:3668
@lalitb lalitb added the bug Something isn't working label Dec 1, 2021
@lalitb lalitb changed the title CAPI unit tests occasionally crashing on CI env. C-API unit tests occasionally crashing on CI env. Dec 1, 2021
@aykejriw aykejriw added the iOS iOS related issue label Jan 4, 2022
@lalitb lalitb self-assigned this Jan 25, 2022
@lalitb
Copy link
Contributor Author

lalitb commented Feb 19, 2022

The test is commented for now, as the crash is more consistent.

./tests/functests/FuncTests --gtest_filter=-APITest.C_API_Test # TBD - CAPI tests are failing in CI. Need to be fixed

Will fix this in separate PR.

@maxgolov
Copy link
Contributor

This is happening because SDK on iOS/Mac does not seem to wait for HTTP stack confirmation that a pending request is either completed or cancelled. A workaround could be to issue mat_pause, mat_flush, wait a second, then mat_close. That'd mean that events are not going to be attempted for upload at the end of the test run. It might be worthwhile to explore what changed with HTTP stack on Apple platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working iOS iOS related issue
Projects
None yet
Development

No branches or pull requests

3 participants