Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hanging on ble.Connect #86

Open
mnadel opened this issue Sep 2, 2021 · 2 comments
Open

Hanging on ble.Connect #86

mnadel opened this issue Sep 2, 2021 · 2 comments

Comments

@mnadel
Copy link

mnadel commented Sep 2, 2021

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
@estutzenberger
Copy link

estutzenberger commented Apr 6, 2022

I'm not sure if this is still and issue for you but you might consider seeing if the same behavior happens in the better patched library at https://github.com/rigado/ble.

Hope this helps.

@Jan21493
Copy link

Jan21493 commented Sep 7, 2024

I know this is issue is quite old, but if somebody has the same, have a look at #112 or rigado/ble#76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants