question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Receive channel's poll fails when dicoverServices is called and keeps app stuck

See original GitHub issue

When we call our device’s deviceConnection.discoverServices() it calls the method written at line 317 of com/beepiz/bluetooth/gattcoroutines/GattConnectionImpl.kt, gattRequest. This method receives a channel (ch: ReceiveChannel<GattResponse<E>>) for the request purpose and after a few instructions calls ch.reveice() on this channel. That’s when the problem occours.

The channel throws an error internally the polls fails (as the following print shows) and the exceution goes all the levels up, like when an exception is thrown, but this time without any clue of an error being thrown: image

These are the last captured logs:

D/BluetoothAdapter: STATE_ON
D/BluetoothGatt: connect() - device: 00:15:90:91:CE:C2, auto: false
D/BluetoothAdapter: isSecureModeEnabled
D/BluetoothGatt: registerApp()
D/BluetoothGatt: registerApp() - UUID=5ab39c56-c260-4491-9cac-58843c486207
D/BluetoothGatt: onClientRegistered() - status=0 clientIf=8
D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=8 device=00:15:90:91:CE:C2
D/BluetoothGatt: onConnectionUpdated() - Device=00:15:90:91:CE:C2 interval=16 latency=0 timeout=800 status=0
D/BluetoothGatt: onConnectionUpdated() - Device=00:15:90:91:CE:C2 interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt: onConnectionUpdated() - Device=00:15:90:91:CE:C2 interval=16 latency=0 timeout=800 status=0
D/BluetoothGatt: discoverServices() - device: 00:15:90:91:CE:C2
D/BluetoothGatt: onSearchComplete() = Device=00:15:90:91:CE:C2 Status=0

I tried to capture any thrown exception around the discoverServices() call, but the cursor never comes back to my code after that ch.receive() call.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:26 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
LouisCADcommented, Jan 22, 2020

My bad, it’s defined in buildSrc/build.gradle.kts

On Wed, Jan 22, 2020, 12:53 Luiz Machado notifications@github.com wrote:

You sure? I see no gradle version in there.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Beepiz/BleGattCoroutines/issues/57?email_source=notifications&email_token=ABVG6BMVALLJRIAFVRVRCELQ7AXSTA5CNFSM4KIMUEWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJTI3QQ#issuecomment-577146306, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVG6BLSNKH54CYYXMM6XUTQ7AXSTANCNFSM4KIMUEWA .

0reactions
odahcamcommented, Mar 12, 2020

I noticed another place where the same issue happens: when trying to disable remote device characteristic.

While closing my device’s connection, I try to disable notifications from the characteristic I use and, when I call the method, the app gets stuck on the gattRequest method from GattConnectionImpl. It looks like writeChannel (passed down to the method as the first parameter) is expected to return something that never receives on the ch.receive() call on line 333.

I don’t know why yet, but I cannot write descriptors at this point.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kafka consumer gets stuck after exceeding max.poll.interval.ms
The consumer process hangs and does not consume any more messages. The following error message gets logged. MAXPOLL|rdkafka#consumer-1| [thrd: ...
Read more >
Create a poll in Slack
Survey teammates using a polling app from the Slack App Directory, or create a quick and informal poll in a message. Go for...
Read more >
Poll Everywhere: Host interactive online meetings
Your solution for audience engagement, interactive meetings, and scaled feedback.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found