Skip to content
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

java.lang.IllegalArgumentException when try to use ipv6 #1883

Closed
normanmaurer opened this issue May 30, 2016 · 4 comments · Fixed by #1896
Closed

java.lang.IllegalArgumentException when try to use ipv6 #1883

normanmaurer opened this issue May 30, 2016 · 4 comments · Fixed by #1896
Assignees
Labels
Milestone

Comments

@normanmaurer
Copy link

I guess this is caused by the scopeId:

java.lang.IllegalArgumentException: cannot find a NameResolver for directaddress:////0:0:0:0:0:0:0:0%0:10005 (Malformed escape pair at index 33: directaddress:////0:0:0:0:0:0:0:0%0:10005)
at io.grpc.internal.ManagedChannelImpl.getNameResolver(ManagedChannelImpl.java:238)
at io.grpc.internal.ManagedChannelImpl.(ManagedChannelImpl.java:159)
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:205)
@normanmaurer
Copy link
Author

This was version 0.14.0

@ejona86
Copy link
Member

ejona86 commented May 31, 2016

What's better, is in this case (directaddress) we're actually trying to circumvent the NameResolver, so the URI is mostly unused.

@ejona86 ejona86 added this to the 1.0 milestone May 31, 2016
@ejona86
Copy link
Member

ejona86 commented May 31, 2016

@zhangkun83, do you want to take a look at this?

@normanmaurer
Copy link
Author

@ejona86 haha ok :)

zhangkun83 added a commit to zhangkun83/grpc-java that referenced this issue Jun 3, 2016
This fixes two issues.

1. Use the URI constructor with multiple arguments to construct the placeholder
URI for direct address, so that special characters can be correctly
escaped. This resolves grpc#1883.

It requires the second fix.

2. Stop URI from mistreating paths as authorities.

There is a bug in URI constructors that take multiple arguments.  They simply
concatenate escaped components and try to parse the resulting string.

For example, URI("dns", null, "//127.0.0.1", null), which is what we do
internally when the application passes "/127.0.0.1" as the target, is supposed
to create a [scheme="dns", path="//127.0.0.1"].  Instead, it internally composes
"dns://127.0.0.1", and gets a [scheme="dns", authority="127.0.0.1"].

To avoid this issue, we pass empty string instead of null as the authority to
the URI constructor. The constructor would make "dns:////127.0.0.1" internally
which can be parsed correctly.
zhangkun83 added a commit to zhangkun83/grpc-java that referenced this issue Jun 3, 2016
This fixes two issues.

1) Use the URI constructor with multiple arguments to construct the placeholder
URI for direct address, so that special characters can be correctly
escaped. This resolves grpc#1883.

It requires the second fix.

2) Stop URI from mistreating paths as authorities.

There is a bug in URI constructors that take multiple arguments.  They simply
concatenate escaped components and try to parse the resulting string.

For example, URI("dns", null, "//127.0.0.1", null), which is what we do
internally when the application passes "/127.0.0.1" as the target, is supposed
to create a [scheme="dns", path="//127.0.0.1"].  Instead, it internally composes
"dns://127.0.0.1", which is parsed into [scheme="dns", authority="127.0.0.1"].

To avoid this issue, we pass empty string instead of null as the authority to
the URI constructor. The constructor would make "dns:////127.0.0.1" internally
which can be parsed correctly.
@ejona86 ejona86 modified the milestones: 1.0, 0.15.0 Jul 1, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Sep 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants