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

Restyle For chip/lgtm env #5

Closed
wants to merge 1 commit into from

Conversation

restyled-io[bot]
Copy link

@restyled-io restyled-io bot commented Oct 1, 2020

Automated style fixes for #4, created by Restyled.

The following restylers made fixes:

  • whitespace

To incorporate these changes, merge this Pull Request into the original. We
recommend using the Squash or Rebase strategies.

NOTE: As work continues on the original Pull Request, this process will
re-run and update (force-push) this Pull Request with updated style fixes as
necessary. If the style is fixed manually at any point (i.e. this process finds
no fixes to make), this Pull Request will be closed automatically.

Sorry if this was unexpected. To disable it, see our documentation.

@restyled-io restyled-io bot added the restyled label Oct 1, 2020
@restyled-io restyled-io bot closed this Oct 1, 2020
@restyled-io restyled-io bot deleted the restyled/for-chip/lgtm-env branch October 1, 2020 01:35
mspang added a commit that referenced this pull request Feb 17, 2021
Android isn't able to unwind the CHIP native stack, which interferes
with debugging. Turn on unwind tables to fix this.  Unclear if we want
this in optimized builds, but Android OS seems to be able to unwind all
of frameworks and OS libraries, so for now assume we do. There's only a
space cost, and we can revisit that later.

This is the difference between this:

backtrace:
02-16 20:49:34.628  3872  3872 F DEBUG   : backtrace:
02-16 20:49:34.628  3872  3872 F DEBUG   :       #00 pc 000000000008246c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 5812256023147338b8a9538321d4c456)
02-16 20:49:34.628  3872  3872 F DEBUG   :       #1 pc 00000000000a836c  /data/app/com.google.chip.chiptool-rPVLWEFRvE413khV9YptWg==/base.apk (offset 0x97a000) (chip::NetworkProvisioning::SendNetworkCredentials(char const*, char const*)+96)

and this:
02-16 20:56:04.323  5040  5040 F DEBUG   : backtrace:
02-16 20:56:04.323  5040  5040 F DEBUG   :       #00 pc 000000000008246c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 5812256023147338b8a9538321d4c456)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #1 pc 00000000000a839c  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (chip::NetworkProvisioning::SendNetworkCredentials(char const*, char const*)+96)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #2 pc 000000000009bb58  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (chip::RendezvousSession::SendNetworkCredentials(char const*, char const*)+44)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #3 pc 000000000009bb94  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (non-virtual thunk to chip::RendezvousSession::SendNetworkCredentials(char const*, char const*)+44)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #4 pc 0000000000051488  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (AndroidDeviceControllerWrapper::SendNetworkCredentials(char const*, char const*)+128)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #5 pc 0000000000054188  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (Java_chip_devicecontroller_ChipDeviceController_sendWiFiCredentials+188)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #6 pc 000000000013f350  /apex/com.android.runtime/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: ccd73e8ae9b59d5596b3b8aeef234d43)
<snip>
02-16 20:56:04.327  5040  5040 F DEBUG   :       #75 pc 00000000000be560  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+116) (BuildId: e5b25f8fb9f6bb45ccbeca8c07061dad)
02-16 20:56:04.327  5040  5040 F DEBUG   :       #76 pc 00000000000c13d0  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+776) (BuildId: e5b25f8fb9f6bb45ccbeca8c07061dad)
02-16 20:56:04.327  5040  5040 F DEBUG   :       #77 pc 00000000000034e0  /system/bin/app_process64 (main+1168) (BuildId: ade4367f7cc82a88f668180d34ce79fe)
02-16 20:56:04.327  5040  5040 F DEBUG   :       #78 pc 000000000007dc24  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+108) (BuildId: 5812256023147338b8a9538321d4c456)
mspang added a commit that referenced this pull request Feb 17, 2021
Android isn't able to unwind the CHIP native stack, which interferes
with debugging. Turn on unwind tables to fix this.  Unclear if we want
this in optimized builds, but Android OS seems to be able to unwind all
of its frameworks and native libraries, so for now assume we do. There's
only a space cost, and we can revisit that later.

This is the difference between this:

backtrace:
02-16 20:49:34.628  3872  3872 F DEBUG   : backtrace:
02-16 20:49:34.628  3872  3872 F DEBUG   :       #00 pc 000000000008246c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 5812256023147338b8a9538321d4c456)
02-16 20:49:34.628  3872  3872 F DEBUG   :       #1 pc 00000000000a836c  /data/app/com.google.chip.chiptool-rPVLWEFRvE413khV9YptWg==/base.apk (offset 0x97a000) (chip::NetworkProvisioning::SendNetworkCredentials(char const*, char const*)+96)

and this:
02-16 20:56:04.323  5040  5040 F DEBUG   : backtrace:
02-16 20:56:04.323  5040  5040 F DEBUG   :       #00 pc 000000000008246c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 5812256023147338b8a9538321d4c456)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #1 pc 00000000000a839c  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (chip::NetworkProvisioning::SendNetworkCredentials(char const*, char const*)+96)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #2 pc 000000000009bb58  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (chip::RendezvousSession::SendNetworkCredentials(char const*, char const*)+44)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #3 pc 000000000009bb94  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (non-virtual thunk to chip::RendezvousSession::SendNetworkCredentials(char const*, char const*)+44)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #4 pc 0000000000051488  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (AndroidDeviceControllerWrapper::SendNetworkCredentials(char const*, char const*)+128)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #5 pc 0000000000054188  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (Java_chip_devicecontroller_ChipDeviceController_sendWiFiCredentials+188)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #6 pc 000000000013f350  /apex/com.android.runtime/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: ccd73e8ae9b59d5596b3b8aeef234d43)
<snip>
02-16 20:56:04.327  5040  5040 F DEBUG   :       #75 pc 00000000000be560  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+116) (BuildId: e5b25f8fb9f6bb45ccbeca8c07061dad)
02-16 20:56:04.327  5040  5040 F DEBUG   :       #76 pc 00000000000c13d0  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+776) (BuildId: e5b25f8fb9f6bb45ccbeca8c07061dad)
02-16 20:56:04.327  5040  5040 F DEBUG   :       #77 pc 00000000000034e0  /system/bin/app_process64 (main+1168) (BuildId: ade4367f7cc82a88f668180d34ce79fe)
02-16 20:56:04.327  5040  5040 F DEBUG   :       #78 pc 000000000007dc24  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+108) (BuildId: 5812256023147338b8a9538321d4c456)
mspang added a commit that referenced this pull request Feb 23, 2021
* Fix unwinding on Android

Android isn't able to unwind the CHIP native stack, which interferes
with debugging. Turn on unwind tables to fix this.  Unclear if we want
this in optimized builds, but Android OS seems to be able to unwind all
of its frameworks and native libraries, so for now assume we do. There's
only a space cost, and we can revisit that later.

This is the difference between this:

backtrace:
02-16 20:49:34.628  3872  3872 F DEBUG   : backtrace:
02-16 20:49:34.628  3872  3872 F DEBUG   :       #00 pc 000000000008246c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 5812256023147338b8a9538321d4c456)
02-16 20:49:34.628  3872  3872 F DEBUG   :       #1 pc 00000000000a836c  /data/app/com.google.chip.chiptool-rPVLWEFRvE413khV9YptWg==/base.apk (offset 0x97a000) (chip::NetworkProvisioning::SendNetworkCredentials(char const*, char const*)+96)

and this:
02-16 20:56:04.323  5040  5040 F DEBUG   : backtrace:
02-16 20:56:04.323  5040  5040 F DEBUG   :       #00 pc 000000000008246c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 5812256023147338b8a9538321d4c456)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #1 pc 00000000000a839c  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (chip::NetworkProvisioning::SendNetworkCredentials(char const*, char const*)+96)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #2 pc 000000000009bb58  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (chip::RendezvousSession::SendNetworkCredentials(char const*, char const*)+44)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #3 pc 000000000009bb94  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (non-virtual thunk to chip::RendezvousSession::SendNetworkCredentials(char const*, char const*)+44)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #4 pc 0000000000051488  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (AndroidDeviceControllerWrapper::SendNetworkCredentials(char const*, char const*)+128)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #5 pc 0000000000054188  /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (Java_chip_devicecontroller_ChipDeviceController_sendWiFiCredentials+188)
02-16 20:56:04.323  5040  5040 F DEBUG   :       #6 pc 000000000013f350  /apex/com.android.runtime/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: ccd73e8ae9b59d5596b3b8aeef234d43)
<snip>
02-16 20:56:04.327  5040  5040 F DEBUG   :       #75 pc 00000000000be560  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+116) (BuildId: e5b25f8fb9f6bb45ccbeca8c07061dad)
02-16 20:56:04.327  5040  5040 F DEBUG   :       #76 pc 00000000000c13d0  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+776) (BuildId: e5b25f8fb9f6bb45ccbeca8c07061dad)
02-16 20:56:04.327  5040  5040 F DEBUG   :       #77 pc 00000000000034e0  /system/bin/app_process64 (main+1168) (BuildId: ade4367f7cc82a88f668180d34ce79fe)
02-16 20:56:04.327  5040  5040 F DEBUG   :       #78 pc 000000000007dc24  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+108) (BuildId: 5812256023147338b8a9538321d4c456)

* Make it an argument
mspang added a commit that referenced this pull request Jul 7, 2022
It's not safe to access line editing state from the IO thread while
inside readline() on the main thread.

Remove the code that attempts to redraw readline after printing logs.
This avoids segfaults during logging at the cost of those logs
overwriting the prompt (this is not trivial to fix as readline
is a blocking API).

==================
WARNING: ThreadSanitizer: data race (pid=63005)
  Write of size 1 at 0x55f81c7745ff by main thread:
    #0 InteractiveStartCommand::ParseCommand(char*) ../../examples/chip-tool/commands/interactive/InteractiveCommands.cpp:127 (chip-tool+0x874911)
    #1 InteractiveStartCommand::RunCommand() ../../examples/chip-tool/commands/interactive/InteractiveCommands.cpp:85 (chip-tool+0x874594)
    #2 CHIPCommand::StartWaiting(std::chrono::duration<unsigned int, std::ratio<1l, 1000l> >) ../../examples/chip-tool/commands/common/CHIPCommand.cpp:408 (chip-tool+0x83e478)
    #3 CHIPCommand::Run() ../../examples/chip-tool/commands/common/CHIPCommand.cpp:187 (chip-tool+0x83c839)
    #4 Commands::RunCommand(int, char**, bool) ../../examples/chip-tool/commands/common/Commands.cpp:147 (chip-tool+0x85d4f7)
    #5 Commands::Run(int, char**) ../../examples/chip-tool/commands/common/Commands.cpp:51 (chip-tool+0x85c288)
    #6 main <null> (chip-tool+0x569c0a)

  Previous read of size 1 at 0x55f81c7745ff by thread T5 (mutexes: write M185):
    #0 LoggingCallback ../../examples/chip-tool/commands/interactive/InteractiveCommands.cpp:46 (chip-tool+0x874479)
    #1 chip::Logging::LogV(unsigned char, unsigned char, char const*, __va_list_tag*) ../../src/lib/support/logging/CHIPLogging.cpp:221 (chip-tool+0x8ee4dc)
    #2 chip::Logging::Log(unsigned char, unsigned char, char const*, ...) ../../src/lib/support/logging/CHIPLogging.cpp:172 (chip-tool+0x8ee30a)
    #3 chip::app::ReadClient::RefreshLivenessCheckTimer() <null> (chip-tool+0x8b1746)
    #4 chip::app::ReadClient::ProcessSubscribeResponse(chip::System::PacketBufferHandle&&) ../../src/app/ReadClient.cpp:845 (chip-tool+0x8b20ec)
    #5 chip::app::ReadClient::OnMessageReceived(chip::Messaging::ExchangeContext*, chip::PayloadHeader const&, chip::System::PacketBufferHandle&&) ../../src/app/ReadClient.cpp:409 (chip-tool+0x8ae2a4)
    #6 chip::Messaging::ExchangeContext::HandleMessage(unsigned int, chip::PayloadHeader const&, chip::BitFlags<chip::Messaging::MessageFlagValues, unsigned int>, chip::System::PacketBufferHandle&&) <null> (chip-tool+0xa0517a)
    #7 operator()<chip::Messaging::ExchangeContext> ../../src/messaging/ExchangeMgr.cpp:219 (chip-tool+0xa08c73)
    #8 Call ../../src/lib/support/Pool.h:126 (chip-tool+0xa0912d)
    #9 chip::internal::HeapObjectList::ForEachNode(void*, chip::Loop (*)(void*, void*)) ../../src/lib/support/Pool.cpp:127 (chip-tool+0x8ee05a)
    #10 ForEachActiveObject<chip::Messaging::ExchangeManager::OnMessageReceived(const chip::PacketHeader&, const chip::PayloadHeader&, const chip::SessionHandle&, chip::SessionMessageDelegate::DuplicateMessage, chip::System::PacketBufferHandle&&)::<lambda(auto:2*)> > ../../src/lib/support/Pool.h:396 (chip-tool+0xa08d10)
    #11 chip::Messaging::ExchangeManager::OnMessageReceived(chip::PacketHeader const&, chip::PayloadHeader const&, chip::SessionHandle const&, chip::SessionMessageDelegate::DuplicateMessage, chip::System::PacketBufferHandle&&) ../../src/messaging/ExchangeMgr.cpp:212 (chip-tool+0xa07e91)
    #12 chip::SessionManager::SecureUnicastMessageDispatch(chip::PacketHeader const&, chip::Transport::PeerAddress const&, chip::System::PacketBufferHandle&&) ../../src/transport/SessionManager.cpp:616 (chip-tool+0xa1548b)
    #13 chip::SessionManager::OnMessageReceived(chip::Transport::PeerAddress const&, chip::System::PacketBufferHandle&&) ../../src/transport/SessionManager.cpp:443 (chip-tool+0xa14426)
    #14 chip::TransportMgrBase::HandleMessageReceived(chip::Transport::PeerAddress const&, chip::System::PacketBufferHandle&&) ../../src/transport/TransportMgrBase.cpp:76 (chip-tool+0xa17dfa)
    #15 chip::Transport::Base::HandleMessageReceived(chip::Transport::PeerAddress const&, chip::System::PacketBufferHandle&&) ../../src/transport/raw/Base.h:102 (chip-tool+0xb19728)
    #16 chip::Transport::UDP::OnUdpReceive(chip::Inet::UDPEndPoint*, chip::System::PacketBufferHandle&&, chip::Inet::IPPacketInfo const*) ../../src/transport/raw/UDP.cpp:122 (chip-tool+0xb1a48b)
    #17 chip::Inet::UDPEndPointImplSockets::HandlePendingIO(chip::BitFlags<chip::System::SocketEventFlags, unsigned char>) ../../src/inet/UDPEndPointImplSockets.cpp:688 (chip-tool+0xb00aa0)
    #18 chip::Inet::UDPEndPointImplSockets::HandlePendingIO(chip::BitFlags<chip::System::SocketEventFlags, unsigned char>, long) ../../src/inet/UDPEndPointImplSockets.cpp:569 (chip-tool+0xafff89)
    #19 chip::System::LayerImplSelect::HandleEvents() ../../src/system/SystemLayerImplSelect.cpp:406 (chip-tool+0xb07563)
    #20 chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX<chip::DeviceLayer::PlatformManagerImpl>::_RunEventLoop() ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:181 (chip-tool+0x98a227)
    #21 chip::DeviceLayer::PlatformManager::RunEventLoop() ../../src/include/platform/PlatformManager.h:362 (chip-tool+0x988f75)
    #22 chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX<chip::DeviceLayer::PlatformManagerImpl>::EventLoopTaskMain(void*) ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:205 (chip-tool+0x98a87c)

  Location is global '(anonymous namespace)::gIsCommandRunning' of size 1 at 0x55f81c7745ff (chip-tool+0x000000c485ff)

  Mutex M185 (0x55f81c776180) created at:
    #0 pthread_mutex_lock ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4240 (libtsan.so.0+0x4f30a)
    #1 chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX<chip::DeviceLayer::PlatformManagerImpl>::_LockChipStack() ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:78 (chip-tool+0x989e90)
    #2 chip::DeviceLayer::PlatformManager::LockChipStack() ../../src/include/platform/PlatformManager.h:410 (chip-tool+0x988fa5)
    #3 chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX<chip::DeviceLayer::PlatformManagerImpl>::_RunEventLoop() ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:170 (chip-tool+0x98a147)
    #4 chip::DeviceLayer::PlatformManager::RunEventLoop() ../../src/include/platform/PlatformManager.h:362 (chip-tool+0x988f75)
    #5 chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX<chip::DeviceLayer::PlatformManagerImpl>::EventLoopTaskMain(void*) ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:205 (chip-tool+0x98a87c)

  Thread T5 (tid=63013, running) created by main thread at:
    #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x5ad75)
    #1 chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX<chip::DeviceLayer::PlatformManagerImpl>::_StartEventLoopTask() ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:231 (chip-tool+0x98a40a)
    #2 chip::DeviceLayer::PlatformManager::StartEventLoopTask() ../../src/include/platform/PlatformManager.h:375 (chip-tool+0xaacca2)
    #3 chip::Controller::DeviceControllerFactory::ServiceEvents() ../../src/controller/CHIPDeviceControllerFactory.cpp:331 (chip-tool+0xab0417)
    #4 CHIPCommand::StartWaiting(std::chrono::duration<unsigned int, std::ratio<1l, 1000l> >) ../../examples/chip-tool/commands/common/CHIPCommand.cpp:403 (chip-tool+0x83e353)
    #5 CHIPCommand::Run() ../../examples/chip-tool/commands/common/CHIPCommand.cpp:187 (chip-tool+0x83c839)
    #6 Commands::RunCommand(int, char**, bool) ../../examples/chip-tool/commands/common/Commands.cpp:147 (chip-tool+0x85d4f7)
    #7 Commands::Run(int, char**) ../../examples/chip-tool/commands/common/Commands.cpp:51 (chip-tool+0x85c288)
    #8 main <null> (chip-tool+0x569c0a)

SUMMARY: ThreadSanitizer: data race ../../examples/chip-tool/commands/interactive/InteractiveCommands.cpp:127 in InteractiveStartCommand::ParseCommand(char*)
==================
mspang added a commit that referenced this pull request Jul 11, 2022
It's not safe to access line editing state from the IO thread while
inside readline() on the main thread.

Remove the code that attempts to redraw readline after printing logs.
This avoids segfaults during logging at the cost of those logs
overwriting the prompt (this is not trivial to fix as readline
is a blocking API).

==================
WARNING: ThreadSanitizer: data race (pid=63005)
  Write of size 1 at 0x55f81c7745ff by main thread:
    #0 InteractiveStartCommand::ParseCommand(char*) ../../examples/chip-tool/commands/interactive/InteractiveCommands.cpp:127 (chip-tool+0x874911)
    #1 InteractiveStartCommand::RunCommand() ../../examples/chip-tool/commands/interactive/InteractiveCommands.cpp:85 (chip-tool+0x874594)
    #2 CHIPCommand::StartWaiting(std::chrono::duration<unsigned int, std::ratio<1l, 1000l> >) ../../examples/chip-tool/commands/common/CHIPCommand.cpp:408 (chip-tool+0x83e478)
    #3 CHIPCommand::Run() ../../examples/chip-tool/commands/common/CHIPCommand.cpp:187 (chip-tool+0x83c839)
    #4 Commands::RunCommand(int, char**, bool) ../../examples/chip-tool/commands/common/Commands.cpp:147 (chip-tool+0x85d4f7)
    #5 Commands::Run(int, char**) ../../examples/chip-tool/commands/common/Commands.cpp:51 (chip-tool+0x85c288)
    #6 main <null> (chip-tool+0x569c0a)

  Previous read of size 1 at 0x55f81c7745ff by thread T5 (mutexes: write M185):
    #0 LoggingCallback ../../examples/chip-tool/commands/interactive/InteractiveCommands.cpp:46 (chip-tool+0x874479)
    #1 chip::Logging::LogV(unsigned char, unsigned char, char const*, __va_list_tag*) ../../src/lib/support/logging/CHIPLogging.cpp:221 (chip-tool+0x8ee4dc)
    #2 chip::Logging::Log(unsigned char, unsigned char, char const*, ...) ../../src/lib/support/logging/CHIPLogging.cpp:172 (chip-tool+0x8ee30a)
    #3 chip::app::ReadClient::RefreshLivenessCheckTimer() <null> (chip-tool+0x8b1746)
    #4 chip::app::ReadClient::ProcessSubscribeResponse(chip::System::PacketBufferHandle&&) ../../src/app/ReadClient.cpp:845 (chip-tool+0x8b20ec)
    #5 chip::app::ReadClient::OnMessageReceived(chip::Messaging::ExchangeContext*, chip::PayloadHeader const&, chip::System::PacketBufferHandle&&) ../../src/app/ReadClient.cpp:409 (chip-tool+0x8ae2a4)
    #6 chip::Messaging::ExchangeContext::HandleMessage(unsigned int, chip::PayloadHeader const&, chip::BitFlags<chip::Messaging::MessageFlagValues, unsigned int>, chip::System::PacketBufferHandle&&) <null> (chip-tool+0xa0517a)
    #7 operator()<chip::Messaging::ExchangeContext> ../../src/messaging/ExchangeMgr.cpp:219 (chip-tool+0xa08c73)
    #8 Call ../../src/lib/support/Pool.h:126 (chip-tool+0xa0912d)
    #9 chip::internal::HeapObjectList::ForEachNode(void*, chip::Loop (*)(void*, void*)) ../../src/lib/support/Pool.cpp:127 (chip-tool+0x8ee05a)
    #10 ForEachActiveObject<chip::Messaging::ExchangeManager::OnMessageReceived(const chip::PacketHeader&, const chip::PayloadHeader&, const chip::SessionHandle&, chip::SessionMessageDelegate::DuplicateMessage, chip::System::PacketBufferHandle&&)::<lambda(auto:2*)> > ../../src/lib/support/Pool.h:396 (chip-tool+0xa08d10)
    #11 chip::Messaging::ExchangeManager::OnMessageReceived(chip::PacketHeader const&, chip::PayloadHeader const&, chip::SessionHandle const&, chip::SessionMessageDelegate::DuplicateMessage, chip::System::PacketBufferHandle&&) ../../src/messaging/ExchangeMgr.cpp:212 (chip-tool+0xa07e91)
    #12 chip::SessionManager::SecureUnicastMessageDispatch(chip::PacketHeader const&, chip::Transport::PeerAddress const&, chip::System::PacketBufferHandle&&) ../../src/transport/SessionManager.cpp:616 (chip-tool+0xa1548b)
    #13 chip::SessionManager::OnMessageReceived(chip::Transport::PeerAddress const&, chip::System::PacketBufferHandle&&) ../../src/transport/SessionManager.cpp:443 (chip-tool+0xa14426)
    #14 chip::TransportMgrBase::HandleMessageReceived(chip::Transport::PeerAddress const&, chip::System::PacketBufferHandle&&) ../../src/transport/TransportMgrBase.cpp:76 (chip-tool+0xa17dfa)
    #15 chip::Transport::Base::HandleMessageReceived(chip::Transport::PeerAddress const&, chip::System::PacketBufferHandle&&) ../../src/transport/raw/Base.h:102 (chip-tool+0xb19728)
    #16 chip::Transport::UDP::OnUdpReceive(chip::Inet::UDPEndPoint*, chip::System::PacketBufferHandle&&, chip::Inet::IPPacketInfo const*) ../../src/transport/raw/UDP.cpp:122 (chip-tool+0xb1a48b)
    #17 chip::Inet::UDPEndPointImplSockets::HandlePendingIO(chip::BitFlags<chip::System::SocketEventFlags, unsigned char>) ../../src/inet/UDPEndPointImplSockets.cpp:688 (chip-tool+0xb00aa0)
    #18 chip::Inet::UDPEndPointImplSockets::HandlePendingIO(chip::BitFlags<chip::System::SocketEventFlags, unsigned char>, long) ../../src/inet/UDPEndPointImplSockets.cpp:569 (chip-tool+0xafff89)
    #19 chip::System::LayerImplSelect::HandleEvents() ../../src/system/SystemLayerImplSelect.cpp:406 (chip-tool+0xb07563)
    #20 chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX<chip::DeviceLayer::PlatformManagerImpl>::_RunEventLoop() ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:181 (chip-tool+0x98a227)
    #21 chip::DeviceLayer::PlatformManager::RunEventLoop() ../../src/include/platform/PlatformManager.h:362 (chip-tool+0x988f75)
    #22 chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX<chip::DeviceLayer::PlatformManagerImpl>::EventLoopTaskMain(void*) ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:205 (chip-tool+0x98a87c)

  Location is global '(anonymous namespace)::gIsCommandRunning' of size 1 at 0x55f81c7745ff (chip-tool+0x000000c485ff)

  Mutex M185 (0x55f81c776180) created at:
    #0 pthread_mutex_lock ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4240 (libtsan.so.0+0x4f30a)
    #1 chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX<chip::DeviceLayer::PlatformManagerImpl>::_LockChipStack() ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:78 (chip-tool+0x989e90)
    #2 chip::DeviceLayer::PlatformManager::LockChipStack() ../../src/include/platform/PlatformManager.h:410 (chip-tool+0x988fa5)
    #3 chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX<chip::DeviceLayer::PlatformManagerImpl>::_RunEventLoop() ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:170 (chip-tool+0x98a147)
    #4 chip::DeviceLayer::PlatformManager::RunEventLoop() ../../src/include/platform/PlatformManager.h:362 (chip-tool+0x988f75)
    #5 chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX<chip::DeviceLayer::PlatformManagerImpl>::EventLoopTaskMain(void*) ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:205 (chip-tool+0x98a87c)

  Thread T5 (tid=63013, running) created by main thread at:
    #0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x5ad75)
    #1 chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIX<chip::DeviceLayer::PlatformManagerImpl>::_StartEventLoopTask() ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:231 (chip-tool+0x98a40a)
    #2 chip::DeviceLayer::PlatformManager::StartEventLoopTask() ../../src/include/platform/PlatformManager.h:375 (chip-tool+0xaacca2)
    #3 chip::Controller::DeviceControllerFactory::ServiceEvents() ../../src/controller/CHIPDeviceControllerFactory.cpp:331 (chip-tool+0xab0417)
    #4 CHIPCommand::StartWaiting(std::chrono::duration<unsigned int, std::ratio<1l, 1000l> >) ../../examples/chip-tool/commands/common/CHIPCommand.cpp:403 (chip-tool+0x83e353)
    #5 CHIPCommand::Run() ../../examples/chip-tool/commands/common/CHIPCommand.cpp:187 (chip-tool+0x83c839)
    #6 Commands::RunCommand(int, char**, bool) ../../examples/chip-tool/commands/common/Commands.cpp:147 (chip-tool+0x85d4f7)
    #7 Commands::Run(int, char**) ../../examples/chip-tool/commands/common/Commands.cpp:51 (chip-tool+0x85c288)
    #8 main <null> (chip-tool+0x569c0a)

SUMMARY: ThreadSanitizer: data race ../../examples/chip-tool/commands/interactive/InteractiveCommands.cpp:127 in InteractiveStartCommand::ParseCommand(char*)
==================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant