Bluez: connection to bluez gatt server drops in raspberry pi 3B+

Bug #1775203 reported by Visakh Venugopal
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Raspbian
New
Undecided
Unassigned

Bug Description

I am running a customized gatt-server on my Rpi B+. This program was working fine on raspberry pi 3B with Bluez5.39.
But in Rpi 3B+, after the Bluetooth connection is established, it is getting disconnected exactly after 30 seconds.

When investigating with gdb, it is observed that the bluez io_callback() from mainloop_run() is receiving EPOLLHUP, EPOLLERR polling error codes which cause bluez to terminate the connection by calling mainloop_quit(). This issue occurs(in Rpi 3B+) regardless of bluez versions I have tested (v5.39, v5.47, v5.49) and my custom application works fine on Rpi 3B (with bluez v5.39).

The exact issue was again reproduced with the test GATT server implementation included in the bluez4.59 package.

this is the shellcode we run

$ sudo hciconf set name "test"
$ sudo hciconf hci0 noleadv
$ sudo hciconf hci0 down
$ sudo hciconf hci0 up
$ sudo hciconfig hci0 leadv 0
$ ./bluez-5.49/tools/btgatt-server -r

I used Lightblue app on iPhone 5c to debug Bluetooth connection.

The Bluetooth error codes seem to say that the remote host initiated a teardown or disconnection - which is the light blue app, but it didn't. The connection is stable for 30 seconds, then disconnection happens. During the 30 seconds, everything works fine - like attribute read, write, notifications etc.

trimmed log from btmon utility
----------------------
> HCI Event: Disconnect Complete (0x05) plen 4 [hci0] 45.712373
        Status: Success (0x00)
        Handle: 64
        Reason: Remote User Terminated Connection (0x13)
@ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0002} [hci0] 45.712446
        LE Address: 55:6A:20:5D:97:B4 (Resolvable)
        Reason: Connection terminated by remote host (0x03)
@ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0001} [hci0] 45.712446
        LE Address: 55:6A:20:5D:97:B4 (Resolvable)
        Reason: Connection terminated by remote host (0x03)

I have tried upgrading my raspberry pi 3B+ to the latest kernel and firmware (Linux raspberrypi 4.14.44-v7+ #1117 SMP Thu May 31 16:57:56 BST 2018 armv7l GNU/Linux) but it also failed.

system details
---------------------
Raspberry Pi B+
Linux raspberrypi 4.14.34-v7+ #1110 SMP Mon Apr 16 15:18:51 BST 2018 armv7l GNU/Linux
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian

the full log is attached

Revision history for this message
Visakh Venugopal (visakhvenugopal) wrote :
Revision history for this message
Lars Knudsen (larsgk) wrote :

I remember a bug which might be the same, where BlueZ would drop the connection to GATT if no pairing was done within 30 sec. It was fixed though (try a more recent version)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.