grpc / grpc/grpc-java

android: Disabled background data causes errors

Offen
#8,188 7 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @temawi Auf GitHub ansehen
android question
Vorherrschende Sprache
Java
Sterne
12.1k
Forks
4k
Ø Merge
2 T. 17 Std.
Gemergte PRs (30 T.)
37

Beschreibung

Hello, we have an app, that implements a widget that gets data using a GRPC stream on an update. However we have many instances where the widget fails to update where we are receiving:

```
io.grpc.StatusRuntimeException: UNAVAILABLE: Keepalive failed. The connection is likely gone
at io.grpc.Status.asRuntimeException(Status.java:533)
at io.grpc.stub.ClientCalls$BlockingResponseStream.hasNext(ClientCalls.java:629)
at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:722)
at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:752)
at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:743)
```
we are building our channel with the following parameters:

```
AndroidChannelBuilder.forAddress("", 443)
.context(context)
.keepAliveWithoutCalls(true)
.keepAliveTime(5, TimeUnit.SECONDS)
.keepAliveTimeout(5, TimeUnit.SECONDS)
.useTransportSecurity()
.intercept(MetadataInterceptor())
.build()
```
and we care calling our stream collection using:

```
clientWalletCall =
channel.newCall(ChartsServiceGrpc.getGetWalletLiveChartMethod(), service.callOptions)
```

I am assuming, when the app goes the background (due to the user's OS setting restricting background data) that the main grpc channel gets broken and needs time to restart, so when the widget wakes up to update, the call fails.

What is the best way to address this issue where we need block till the channel is ready to ensure the stream is successful?

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.