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

TerminalException thrown for bluetooth readers #496

Closed
wkol opened this issue Sep 11, 2024 · 5 comments
Closed

TerminalException thrown for bluetooth readers #496

wkol opened this issue Sep 11, 2024 · 5 comments

Comments

@wkol
Copy link

wkol commented Sep 11, 2024

Summary

After upgrading the SDK to version 3.9.0 we started observing a large amount of crashes with the following stack trace:

   Fatal Exception: com.stripe.stripeterminal.external.models.TerminalException: Bluetooth scan timed out
       at com.stripe.stripeterminal.internal.common.adapter.BbposBluetoothAdapter$DiscoverBluetoothReadersOperation.createTimeoutException(BbposBluetoothAdapter.kt:567)
       at com.stripe.stripeterminal.internal.common.adapter.BbposAdapter$DiscoverReadersOperation$timeoutFlow$1.invokeSuspend(BbposAdapter.kt:1159)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
       at java.lang.Thread.run(Thread.java:1012)

This happens when the discovery process for Bluetooth readers (e.g. M2) results in a timeout. Firstly, the exception is passed to the callback onFailure, but later, it is also thrown.

Code to reproduce

Terminal.getInstance().discoverReaders(
    config =  DiscoveryConfiguration.BluetoothDiscoveryConfiguration(
            timeout = 5,
            isSimulated = false
        )
    discoveryListener = discoveryListener,
    callback = callback
)

Android version

12, 13, 14 (but I suppose it is not a version-specific problem)

Impacted devices (Android devices or readers)

Bluetooth readers (e.g M2) Internet readers seems fine

SDK version

3.9.0, but checked on 3.9.1 and it still occurs

@nk-stripe
Copy link

Hi, thanks for posting this issue. We’ve reproduced the problem and are actively working on a fix.

@usaimbhayat-stripe
Copy link
Contributor

Hi @wkol, issue is now fixed in the 3.9.2 release.

@Ekalips
Copy link

Ekalips commented Sep 13, 2024

Hi @usaimbhayat-stripe , the issue is still reproducible on 3.9.2

com.stripe.stripeterminal.external.models.TerminalException: Bluetooth scan timed out
	at com.stripe.stripeterminal.internal.common.adapter.BbposBluetoothAdapter$DiscoverBluetoothReadersOperation.createTimeoutException(BbposBluetoothAdapter.kt:567)
	at com.stripe.stripeterminal.internal.common.adapter.BbposAdapter$DiscoverReadersOperation$timeoutFlow$1.invokeSuspend(BbposAdapter.kt:1159)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
	at java.lang.Thread.run(Thread.java:1012)
	Suppressed: kotlinx.coroutines.flow.internal.AbortFlowException: Flow was aborted, no more elements needed
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [CoroutineName(Transaction), LazyStandaloneCoroutine{Cancelling}@6f8076c, java.util.concurrent.Executors$FinalizableDelegatedExecutorService@3664135]

@billfinn-stripe
Copy link
Collaborator

Hi @Ekalips -- thanks. It looks like the fix didn't make it into the 3.9.2 release. We're working on fixing this now, and we're planning on releasing a 3.9.3.

@nk-stripe nk-stripe reopened this Sep 13, 2024
@usaimbhayat-stripe
Copy link
Contributor

Hi @wkol @Ekalips, we have just released 3.9.3 to address this bug. We've done our best to thoroughly test this, please let us know if you still have issues.

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

5 participants