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

Bug: StatusException: UNAVAILABLE: End of stream or IOException - the library function should throw exception so we can handle that in our code and do the appropriate action for that #233

Closed
rsappelit opened this issue Apr 19, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@rsappelit
Copy link

Describe the bug

Point 1: We have used this code to get the streamMessages of converstations

var client = XMTPManager.fetchClient()
            if (client == null) {
                viewModelScope.launch {
                    XMTPManager.setupXMTP {
                        client = XMTPManager.fetchClient()
                        Unit
                    }
                }
            }
            client
                ?.conversations
                ?.streamAllMessages()
                ?.flowWhileShared(
                    subscriptionCount, SharingStarted.WhileSubscribed(1000L)
                )
                ?.flowOn(Dispatchers.IO)
                ?.distinctUntilChanged()
                ?.mapLatest { conversation ->
                    XMTPManager.parseMessage(conversation)
//                    throw Exception("Test Crash")
                }
                ?.catch {
                    Logger.e(TAG, it.message, it)
                    emptyFlow<MessageInfo>()
                } ?: emptyFlow<MessageInfo>()

Point 2 : If Conversation screen is Active for 15 to 20 minutes then this crash happens

FATAL EXCEPTION: DefaultDispatcher-worker-5
                 Process: com.qriptos.app.dev, PID: 26058
                 io.grpc.StatusException: UNAVAILABLE: End of stream or IOException
                 	at io.grpc.Status.asException(Status.java:548)
                 	at io.grpc.kotlin.ClientCalls$rpcImpl$1$1$1.onClose(ClientCalls.kt:300)
                 	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:574)
                 	at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:72)
                 	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:742)
                 	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:723)
                 	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
                 	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
                 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
                 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
                 	at java.lang.Thread.run(Thread.java:784)

Expected behavior

Whenever any crash happens in the library function than throw the exception. So we can handle that exception in our project code and perform the appropriate action according to that.

Steps to reproduce the bug

  1. Open the Conversation listing Screen
  2. Stay there for 15 to 20 minutes
  3. And App will be crashed
@rsappelit rsappelit added the bug Something isn't working label Apr 19, 2024
@nplasterer nplasterer self-assigned this Apr 19, 2024
@bwcDvorak
Copy link
Contributor

Thanks for reporting this! Can we ask what version of the SDK you're testing on when this happens?

@rsappelit
Copy link
Author

Version : 0.10.5
Date : 19-Apri-24
Tested on these devices Device : Google Pixel 5 , Y7 Prime 2019

@nplasterer
Copy link
Contributor

nplasterer commented May 3, 2024

I'm hoping that these streaming crashes should get fixed with this backend update. xmtp/xmtp-node-go#388 I'll still work to surface the error so it's easier to catch and not crash.

@nplasterer
Copy link
Contributor

Latest Android release should no longer have these issues. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants