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

[linux] Make BLE connection retry on SW connection abort error #20

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

LuDuda
Copy link
Owner

@LuDuda LuDuda commented May 8, 2022

Make BLE connection retry on getting the following error:
FAIL: ConnectDevice : GDBus.Error:org.bluez.Error.Failed: Software caused connection abort.

Tested with nRF Connect platform, triggering above error, commissioning passed.

// D-Bus method, or else `Connect()` returns immediately without any effect.
// Note that still there is a global timeout that applies, so there is no need to limit retries.
if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR) &&
strstr(error->message, "Software caused connection abort"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest removing the strstr check and handle all IO errors that way, but adding some max number of attempts (so that the controller doesn't get stuck if some real hardware failure occurs).

Copy link
Collaborator

@Damian-Nordic Damian-Nordic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for that by the way! :)

kghost and others added 8 commits May 9, 2022 08:43
…of the SystemCommand simulated cluster (project-chip#18038)

* [YAML] Fix a typo in src/app/zap-templates/common/simulated-clusters/clusters/DiscoveryCommands.js

* [YAML] Generate TLV parameters for the simulated clusters

* Update src/app/tests/suites/commands/delay/DelayCommands.*

* Update Update src/app/tests/suites/commands/log/LogCommands.*

* Update src/app/tests/suites/commands/commissioner/CommissionerCommands.*

* Update src/app/tests/suites/commands/discovery/DiscoveryCommands.*

* Update src/app/tests/suites/commands/system/SystemCommands.*

* Update chip-tool for the API changes

* Update chip-tool-darwin

* Update generated content

* [YAML] Add minCommissioningTimeout option to SystemCommands::Start

* Add min commissioning timeout into the SystemCommands tests
* [sleepy] Initial rename of CRA/CRI to SAI/SII.

* [sleepy] More CRA/CRI -> SAI/SII rename.

* [sleepy] Update comments per review.

* [sleepy] Test mainline case: SAI < SII.

* [sleepy] Fix test after SAI < SII.
…chip#18221)

Allows us to remove the in-framework key generation bits.
* [chip-tool-darwin] Enable TestSystemCommands

* Update generated test code
pankore and others added 4 commits May 9, 2022 20:31
…roject-chip#18079)

* [OTA] NotifyUpdateApplied to be sent after device first reboot into new image
- Added IsFirstRun and ConfirmCurrentImage checks
- Currently added delay of 15seconds in example_matter to give time for
  ameba to obtain ipv6 address
- TODO: Need to move wlan fast connect into matter using DCT

* Restyled by clang-format

Co-authored-by: Restyled.io <[email protected]>
…roject-chip#17935)

* [coverage] Add use_coverage flag to add --coverage to clang builds.

* [coverage] Add -o option to run lcov in a prebuilt output directory.

* [coverage] Fixes for review comments.

* [coverage] Rephrase use_coverage comment.
…ect-chip#18220)

The Darwin codegen was only generating things for
clusters/commands/attributes enabled in controller-clusters.zap.  We
should generate for everything instead.
pankore and others added 9 commits May 10, 2022 09:05
* Chef - Add stateful_shell.py and constants.py

Change-Id: Ia59a3d2a71204e4af2c41d6192d47f048a58c3b4

* Chef - Print splash text

Change-Id: I9b162cabab700e87f12806668b2953bf57348449

* Chef - Use textwrap.dedent on textblocks

Change-Id: I861f24ac20d440cf4a3e605809421a766ecdd476

* Chef - Remove use of commandQueue

Change-Id: I75d5ae6fea25c6b933cb9823a29e9c2224b8188d

* Chef - Replace shell writes with Python open() calls

Change-Id: I0147fa6b96d3a15bf95352acbd136e8f1e648b8f

* Chef - Make paths into global constants

Change-Id: Ib177d584bcd463aaafe10f4f338a90d6b234c3f1

* Chef - Remove HexInputToInt

Change-Id: Iebe5e76c169951e842262530d3feba5ac899a33c

* Chef - Remove unused statements

Change-Id: I56670e31722348fb47a1e59d2651cdcf3f983e28

* Chef - Convert variables to snake case per PEP8

Change-Id: I52520eec1dfb8093c39ce4570aa99cdd0b0d854a

* Chef - Add function type hinting

Change-Id: Ib82f0bf4752819b65d2c76058429931c6986bd83
…sters-app (project-chip#17833)

* [examples] Fix GeneratedCommandList and AcceptedCommandList

* Run Codegen

* Fix test case -- yes, it should contain 8

* Fix Test - Run Codegen

* Fix generated code format
Add some APIs for length constraints. Use them in system module and in
cluster to enforce length constraints.
…roject-chip#18209)

when doing YAML generation.

The YAML codegen was only allowing attributes/commands that were
enabled in controller-clusters.zap.  It should just allow all known
attributes/commands.
Attribute filters are not actually used anymore.
project-chip#18130)

* Skip SetCurrentHeapHighWatermark if GetCurrentHeapUsed is not implemented

* Address review comment
emargolis and others added 2 commits May 10, 2022 11:25
…ip#18125)

In the OpenSSL Implementation of ValidateCertificateChain() function the
intermediate ceritificate is loaded as a trusted certificate, which opens
door to various security attacks.

Updated implementation: now loading intermediate certificate as
untrusted certificate part of cert chain.

Added test case that would identify this issue in the previous implementation.
* address media test case issues

* address issue 17896

* address issue 17902

* address issue 17845

* attempt to fix test suites

* Restyle address media test case issues (project-chip#18159)

* Restyled by google-java-format

* Restyled by clang-format

* Restyled by prettier-markdown

Co-authored-by: Restyled.io <[email protected]>

* address feedback, fix ACL persistence regression

* fix typo

* Restyled by prettier-markdown (project-chip#18215)

Co-authored-by: Restyled.io <[email protected]>

* fix spelling

* address feedback

* address feedback

* undo changes

* Restyled by clang-format (project-chip#18231)

Co-authored-by: Restyled.io <[email protected]>

* address feedback

* Restyled by clang-format (project-chip#18254)

Co-authored-by: Restyled.io <[email protected]>

* Update src/controller/CHIPDeviceControllerSystemState.h

Co-authored-by: Boris Zbarsky <[email protected]>

Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com>
Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
LuDuda pushed a commit that referenced this pull request Nov 29, 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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.