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
Unavailable in grpc queries when android app goes to background #11018
Comments
The DNS name resolver will usually produce a stacktrace with a Cause that may help direct you. |
To rule out HTTP request having DNS cached, could you please test the same flow, but once you create gRPC Channel, call |
Hello!
Now it works correct |
Also, during the debugging of this problem, I've noticed, that retries are not working.
I see in logs just one request:
And after that, I'm getting an exception with Could you please tell, what am I doing wrong? UPD Also, I tried to pass the name of my service I need to retry, it didn't work :(
|
Finally, I've passed But I expected, retries would be enabled for all methods, if specific name of the method was not passed. Also, I expected, that retries would be enabled for all services if specific name of the service was not passed. Could you please tell what is correct behavior in theese cases? UPD UPD
|
btw, initial problem may be related with android dns cache, as you supposed above. The whole error looks like:
And unfortunatelly, retries are not working if this error was thrown. It can be reporduced if you'll pass non-existent host to your retry example https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/retrying/RetryingHelloWorldClient.java#L130 |
A note on your service config - in your earlier comment you had a service config that you wanted to apply to all calls, but it was missing the required "name" field. But your other example config did look correct so I suppose in at least some of your testing retry was configured correctly. You can check out the service config user guide for an example config. But more saliently, it looks like you have uncovered a bug in how the default service config is applied. I created issue #11040 to track the fix for that. Note that this does not seem like an Android specific issue. |
@temawi, thanks, my config really was correct, but I suppose retries didn't work because of the problem I described here. |
Unfortunately in situations where the first DNS lookup fails the default config will not be honored. That is a bug in gRPC that needs to get fixed as part of #11040. Until then, what I can think of as a workaround would be to create your own The Custom Name Resolvers user guide gives some context on this and has a link to an example custom name resolver implementation. Did you have any other issues here besides the service config not getting applied? |
@temawi, thanks, I'll try to use custom resolver
Unfortunately, I did :(
If I add Also, I added |
Just a note that I haven't forgotten about this issue - but I'm not sure how to help troubleshoot it further. This could even be an Android issue where that notification comes in a bit before the network stack is fully ready (but that's just speculation). I take it you are still facing this issue? |
Hello!
Maybe, but HTTP calls seem to be fine. It seems like I'm having a problem only with gRPC calls. |
We noticed one thing when reviewing your question - you are using |
Hello!
I have a problem with grpc queries in kotlin app when my app goes to background. I have a next scheme of relation between my app and backend - when backend needs to wake up a phone, I'm doing next things:
CoroutineWorker
Firebase listener:
Coroutine worker:
It works fine, when app works in foreground, but when I'm locking the phone, after few minutes, this grpc queries are not passing to the backend - I'm getting an error:
Also, I added http queries near before grpc queries - http queries work fine even in background mode. Seems like the problem just with grpc queries.
I thought that problem is related with #8860, but I've updated grpc to the last version and the problem is still reproducing.
My build.gradle file:
The text was updated successfully, but these errors were encountered: