grpc-java
grpc-java copied to clipboard
NPE in ProxyDetectorImpl
What version of gRPC are you using?
1.12.0
What did you expect to see?
A customer using google-cloud-java reported seeing NPEs around the time their RPCs time out. According to the customer, this happens even though they are not using a proxy.
java.lang.NullPointerException
at io.grpc.internal.ProxyDetectorImpl.detectProxy(ProxyDetectorImpl.java:225)
at io.grpc.internal.ProxyDetectorImpl.proxyFor(ProxyDetectorImpl.java:194)
at io.grpc.internal.DnsNameResolver$1.run(DnsNameResolver.java:180)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.lang.Thread.run(Thread.java:811)
It looks like this is the origin of the null:
static {
try {
Class<?> c = Class.forName("sun.net.spi.DefaultProxySelector");
if (c != null && ProxySelector.class.isAssignableFrom(c)) {
theProxySelector = (ProxySelector) c.newInstance();
}
} catch (Exception e) {
theProxySelector = null;
}
}
It seems the exception is swallowed. Is it possible they are running with a Security Manager? Also, would it be possible to set a breakpoint in java.net.ProxySelector.<clinit> and see what the exception is?
CC @zpencer