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

Bluetooth LE crashed/hang while discovery devices

XMLWordPrintable

    • Windows

      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

        1. CrashDiscovery.png
          136 kB
          Hoang Pham
        2. LogCrashDiscovery.txt
          32 kB
          Hoang Pham
        3. BluetoothGetAllCharacteristics_Discover.zip
          7 kB
          Hoang Pham
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes