grpc / grpc/grpc-java

Illegal character in hostname error when using consul and docker

Open
#4,505 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
12.1k
Forks
4k
Avg merge
2d 17h
Merged PRs (30d)
37

Description

I'm having microservices running in Docker containers and I use Consul as service discovery. Every now and then the GRPC calls between the services are failing and I get this exception:

```
io.grpc.internal.ProxyDetectorImpl.detectProxy Failed to construct URI for proxy lookup, proceeding without proxy
java.net.URISyntaxException: Illegal character in hostname at index 19: https://xxx2_xx-yyy-zzz_1.www2_ppp:8192
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.parseHostname(URI.java:3387)
at java.net.URI$Parser.parseServer(URI.java:3236)
at java.net.URI$Parser.parseAuthority(URI.java:3155)
at java.net.URI$Parser.parseHierarchical(URI.java:3097)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.(URI.java:673)
at io.grpc.internal.ProxyDetectorImpl.detectProxy(ProxyDetectorImpl.java:128)
at io.grpc.internal.ProxyDetectorImpl.proxyFor(ProxyDetectorImpl.java:118)
at io.grpc.internal.InternalSubchannel.startNewTransport(InternalSubchannel.java:207)
at io.grpc.internal.InternalSubchannel.obtainActiveTransport(InternalSubchannel.java:188)
at io.grpc.internal.ManagedChannelImpl$SubchannelImpl.requestConnection(ManagedChannelImpl.java:1130)
at io.grpc.PickFirstBalancerFactory$PickFirstBalancer.handleResolvedAddressGroups(PickFirstBalancerFactory.java:79)
...
```

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

### What did you expect to see?
I would expect that when the DNS name contains non-URI friendly characters, the GRPC call to continue to work and encode the URI properly.

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.