Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-99284

Bluetooth LE crashed/hang while discovery devices

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P1: Critical
    • Resolution: Unresolved
    • Affects Version/s: 5.15.7, 6.2.1
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      Windows

      Description

      1. paired BT devices with Windows device manager
      2. start discovery each 10s
      void Widget::startLookup()
      {
          if (!m_discoveryAgent) {
              m_discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
              m_discoveryAgent->setLowEnergyDiscoveryTimeout(10000);
              connect(m_discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &Widget::deviceDiscovered);
      #ifdef QT6_BUILD
              connect(m_discoveryAgent, &QBluetoothDeviceDiscoveryAgent::errorOccurred, this, &Widget::discoveryError);
      #else
              connect(m_discoveryAgent, qOverload<QBluetoothDeviceDiscoveryAgent::Error>(&QBluetoothDeviceDiscoveryAgent::error),
                      this, &Widget::discoveryError);
      #endif
              connect(m_discoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished,
                      this, &Widget::onDeviceScanFinished);
          }
      }
      
      void Widget::onDeviceScanFinished()
      {
          if (m_discoveryAgent) {
              qDebug() << getEpochStr() << "=== restart discovery";
              m_discoveryAgent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod);
          }
      }
      
      • it crahsed more often on windows 11. no connect to any device yet. just only discovering.
      • if we reduce the timeout (ex: from 10s to 2s) -> hang can be happened. and crash more often.
      • i guess: it happened at discoveryAgent->start(). but not sure
        Ivan Solovev

        Attachments

        1. BluetoothGetAllCharacteristics_Discover.zip
          7 kB
          Hoang Pham
        2. CrashDiscovery.png
          136 kB
          Hoang Pham
        3. LogCrashDiscovery.txt
          32 kB
          Hoang Pham

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              ablasche Alex Blasche
              Reporter:
              hoangpham Hoang Pham
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes