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

qlowenergycontroller_bluez: too many open sockets and memory leak

    XMLWordPrintable

Details

    • All
    • d67ca376b2111717de88596888f315fba05ef9c3 (qt/qtconnectivity/5.12)

    Description

      Hey,

      In my program bluetooth server I use only one static instance of "QLowEnergyController" class in "QLowEnergyController::PeripheralRole" during program lifetime.
      I start to advertise waiting for client incoming connection .. after I serve him and he is disconnected I repeat advertising cycle. After few such cycles I noticed too many open sockets and no new connection could be established (Please look: qtconnectivity_5.9.7_to_many_open_files.log )

      I compiled qtconnectivity 5.9.7 with patch (qtconnectivity_5.9.7_debug.patch) and was able to identify not released socket. In log qtconnectivity_5.9.7_debug.log :

      qt.bluetooth.bluez: closeServerSocket : 3065 close socket: 12
      qt.bluetooth.bluez: handleConnectionRequest : 3039 before setSocketDescriptor: 12
      qt.bluetooth.bluez: handleConnectionRequest : 3053 after setSocketDescriptor: 13
      qt.bluetooth.bluez: void QBluetoothSocketPrivate::_q_readNotify() 13 error: -1 "Connection reset by peer"
      qt.bluetooth.bluez: closeServerSocket : 3065 close socket: 13
      qt.bluetooth.bluez: handleConnectionRequest : 3039 before setSocketDescriptor: 13
      qt.bluetooth.bluez: handleConnectionRequest : 3053 after setSocketDescriptor: 14
      qt.bluetooth.bluez: void QBluetoothSocketPrivate::_q_readNotify() 14 error: -1 "Connection reset by peer"
      qt.bluetooth.bluez: closeServerSocket : 3065 close socket: 14
      qt.bluetooth.bluez: handleConnectionRequest : 3039 before setSocketDescriptor: 14
      qt.bluetooth.bluez: handleConnectionRequest : 3053 after setSocketDescriptor: 15
      qt.bluetooth.bluez: void QBluetoothSocketPrivate::_q_readNotify() 15 error: -1 "Connection reset by peer"

      socket from line "handleConnectionRequest : 3039" is never closed

      The same function "void QLowEnergyControllerPrivate::handleConnectionRequest"
      is almost the same for version 5.13.

      I believe there is also memory leak (no l2cpSocket deallocation).
      I was manage to fix it with patch:
      qtconnectivity_5.9.7_bluez_handleConnectionRequest.patch

      Please evaluate it.
      Thank you in advance,
      Piotr

      Attachments

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

        Activity

          People

            ablasche Alex Blasche
            killcio Piotr Kilar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes