grpc / grpc/grpc-java

AndroidChannels: failing requests right after network recovery

Open
#5,610 17 comments 5 reactions 1 assignee Claimed by @voidzcy View on GitHub
android bug
Dominant language
Java
Stars
12.1k
Forks
4k
Avg merge
2d 17h
Merged PRs (30d)
37

Description

### What version of gRPC are you using?
1.20.0

### What did you expect to see?
In our project we use android `JobService`, which starts right after device establish network connection. Inside that service we run Grpc request over `AndroidChannel`. We expect to see successful network calls at that point

### What actually happens.
Most of the time, this request fails few times in a row (as `JobService` reschedules itself on failure). At first it seems that though JobService is started, no connection is available for some reason, but then we tried to add simple http request via `OkHttpClient` - and they work well. Additional digging in logs and debugging reveals, that this might be related to `DnsNameResolver`, as it might resolve address when request is already in progress. This issue seems highly related to #4028, but occurs in AndroidChannel.

### Steps to reproduce
Given mentioned setup (JobService + AndroidChannel), it requires android device with API 24+. Issue can be reproduced by toggling off device internet connection (both WiFi and mobile, seems no difference), wait around 10-15 seconds, and toggling on connection.
Example project, which can demonstrate this issue can be found at https://github.com/AntKos/android-grpc-jobservice.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.