Skip to content

Hanging on ble.Connect #86

@mnadel

Description

@mnadel

I'm trying to search for and connect to a BLE device (from a Pi) in a loop w/ a connect timeout, and it always eventually hangs with the below goroutine trace.

The connect is being called with a timeout context:

ctx := ble.WithSigHandler(context.WithTimeout(context.Background(), time.Second*5))
cln, err := ble.Connect(ctx, pm5.filterAdvert)
goroutine 27 [chan receive, 26 minutes]:
github.com/go-ble/ble.Connect(0x5ec7dc, 0x17eea08, 0x1900998, 0x1, 0x1, 0x1900940, 0x5ec7dc)
        /home/pi/go/pkg/mod/github.com/go-ble/[email protected]/gatt.go:147 +0x1a4
<truncated>


goroutine 1083 [syscall, 26 minutes]:
syscall.Syscall(0x3, 0x7, 0x1876000, 0x1000, 0x469ce4, 0x17ee608, 0x0)
        /usr/local/go/src/syscall/asm_linux_arm.s:14 +0x8
golang.org/x/sys/unix.read(0x7, 0x1876000, 0x1000, 0x1000, 0x1876000, 0x7, 0x15b4668)
        /home/pi/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_linux.go:1242 +0x40
golang.org/x/sys/unix.Read(...)
        /home/pi/go/pkg/mod/golang.org/x/[email protected]/unix/syscall_unix.go:157
github.com/go-ble/ble/linux/hci/socket.(*Socket).Read(0x17ee600, 0x1876000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        /home/pi/go/pkg/mod/github.com/go-ble/[email protected]/linux/hci/socket/socket.go:123 +0x50
github.com/go-ble/ble/linux/hci.(*HCI).sktLoop(0x1504240)
        /home/pi/go/pkg/mod/github.com/go-ble/[email protected]/linux/hci/hci.go:300 +0x90
created by github.com/go-ble/ble/linux/hci.(*HCI).Init
        /home/pi/go/pkg/mod/github.com/go-ble/[email protected]/linux/hci/hci.go:153 +0x4cc

goroutine 1084 [select, 26 minutes]:
github.com/go-ble/ble/linux/hci.(*HCI).Accept(0x1504240, 0x16f20c0, 0x4, 0x1, 0x16f20c0)
        /home/pi/go/pkg/mod/github.com/go-ble/[email protected]/linux/hci/gap.go:185 +0xac
github.com/go-ble/ble/linux.loop(0x1504240, 0x17dc200, 0x203)
        /home/pi/go/pkg/mod/github.com/go-ble/[email protected]/linux/device.go:55 +0x1c
created by github.com/go-ble/ble/linux.NewDeviceWithNameAndHandler
        /home/pi/go/pkg/mod/github.com/go-ble/[email protected]/linux/device.go:48 +0x230

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions