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

Read error on QBluetoothSocket after closing it

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.9, 5.10, 5.11.1, 5.11
    • None
    • Mac OS X host, android device (Tablet with Android 6.0.1)
    • Android

    Description

      I'm doing a simple application which uses bluetooth connection but I'm getting all kind of errors when disconnecting the sockets, I don't know if these are innocuous errors (stuff qt is handling but just warning) but this thread on the qt forums https://forum.qt.io/topic/92241/bluetooth-on-android/5 seemed to indicate it was indeed a bug. I added an example that reproduces the error. Mind you'll need a device acting as server/receiver (If needed I might do one, don't have one currently). 

       

      You can trigger this by just opening and closing the socket, or if you send data you'll get a different error.

       
      When just opening and closing the socket
       

      D libQtBluetoothBug.so: ../QtBluetoothBug/test_class.h:29 (void test_class::onConnected()): connected
      W System.err: java.io.IOException: socket closed
      W System.err: at android.net.LocalSocketImpl$SocketInputStream.read(LocalSocketImpl.java:95)
      W System.err: at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:570)
      W System.err: at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:96)
      W System.err: at java.io.InputStream.read(InputStream.java:162)
      W System.err: at org.qtproject.qt5.android.bluetooth.QtBluetoothInputStreamThread.run(QtBluetoothInputStreamThread.java:86)
      W libQtBluetoothBug.so: (null):0 ((null)): QMutex: destroying locked mutex
      

       

      After sending data and closing the socket, seems like it tries to read again?

      D libQtBluetoothBug.so: ../QtBluetoothBug/test_class.h:30 (void test_class::onConnected()): connected
      W System.err: java.io.IOException: bt socket closed, read return: -1
      W System.err: 	at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:573)
      W System.err: 	at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:96)
      W System.err: 	at java.io.InputStream.read(InputStream.java:162)
      W System.err: 	at org.qtproject.qt5.android.bluetooth.QtBluetoothInputStreamThread.run(QtBluetoothInputStreamThread.java:86)
      

       

      Attachments

        1. main.cpp
          0.3 kB
        2. QtBluetoothBug.pro
          0.9 kB
        3. test_class.h
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ablasche Alex Blasche
            ifhmcos ifhmcos
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes