-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
UdsChannelBuilder does not work with WiFi Proxy on Android.
What version of gRPC-Java are you using?
1.70.0
What is your environment?
Android
What did you expect to see?
gRPC connection to work
What did you see instead?
TRANSIENT_FAILURE
[{0}] Failed to resolve name. status={1}
[{0}] Failed to resolve name. status={1}
[{0}] Failed to resolve name. status={1}
[{0}] Failed to resolve name. status={1}
[{0}] Failed to resolve name. status={1}
[{0}] Failed to resolve name. status={1}
[{0}] Failed to resolve name. status={1}
Steps to reproduce the bug
Setup UdsChannelBuilder and connect to a server.
Connect to a WiFi on Android
On the WiFi you are connected press the pen symbol to add a proxy
Add a dummy proxy
The UdsChannelBuilder will be unable to connect and ends up in TRANSIENT_FAILURE state.
I've managed to find a workaround by setting proxyDetector to be null:
private val channel =
UdsChannelBuilder.forPath(
rpcSocketFile.absolutePath,
LocalSocketAddress.Namespace.FILESYSTEM,
)
.proxyDetector { null }
.build()
Adding a log to the proxy detector I can see that a lookup happens:
Proxy detector invoked for: 127.0.0.1/<unresolved>:80
I believe the bug goes as follows:
Under the hood the UdsChannelBuilder uses a ManagedChannelImpl, however it with a bit of a hack uses 127.0.0.1, see here
| .invoke(null, "dns:///127.0.0.1", InsecureChannelCredentials.create()); |
By default if no ProxyDetector is set but if none is set a default is applied in ManagedChannelImpl here
| builder.proxyDetector != null ? builder.proxyDetector : GrpcUtil.DEFAULT_PROXY_DETECTOR; |
So default proxy detector will then yield an error when trying to lookup 127.0.0.1, maybe because internet didn't work through the proxy? My guess is that this is then emitted as an error and thus it enters here
| logger.log(Level.WARNING, "[{0}] Failed to resolve name. status={1}", |
TransientFailure.