Skip to content

grpc-js: fix explicit ipv6 addresses not resolving correctly - #1199

Merged
murgatroid99 merged 1 commit into
grpc:masterfrom
ortoo:master
Nov 22, 2019
Merged

murgatroid99 merged 1 commit into
grpc:masterfrom
ortoo:master

Conversation

@jamessharp

Copy link
Copy Markdown

Trying to connect to a Grpc server via an ipv6 address (e.g. [::1]:58440) fails with the following error:

internal/url.js:243
  throw new ERR_INVALID_URL(input);
  ^

TypeError [ERR_INVALID_URL]: Invalid URL: http://::1:58440
    at onParseError (internal/url.js:243:9)
    at new URL (internal/url.js:319:5)
    at Object.connect (internal/http2/core.js:2893:17)
    at Object.connect (/Users/james/Development/ortoo/api-service/node_modules/@google-cloud/trace-agent/build/src/plugins/plugin-http2.js:119:33)
    at Subchannel.startConnectingInternal (/Users/james/Development/ortoo/api-service/node_modules/@ortoo/infra-grpc-client/node_modules/@ortoo/grpc-utils/node_modules/@grpc/grpc-js/build/src/subchannel.js:183:31)
    at Subchannel.transitionToState (/Users/james/Development/ortoo/api-service/node_modules/@ortoo/infra-grpc-client/node_modules/@ortoo/grpc-utils/node_modules/@grpc/grpc-js/build/src/subchannel.js:250:22)
    at Subchannel.startConnecting (/Users/james/Development/ortoo/api-service/node_modules/@ortoo/infra-grpc-client/node_modules/@ortoo/grpc-utils/node_modules/@grpc/grpc-js/build/src/subchannel.js:358:19)
    at PickFirstLoadBalancer.exitIdle (/Users/james/Development/ortoo/api-service/node_modules/@ortoo/infra-grpc-client/node_modules/@ortoo/grpc-utils/node_modules/@grpc/grpc-js/build/src/load-balancer-pick-first.js:305:24)
    at ResolvingLoadBalancer.exitIdle (/Users/james/Development/ortoo/api-service/node_modules/@ortoo/infra-grpc-client/node_modules/@ortoo/grpc-utils/node_modules/@grpc/grpc-js/build/src/resolving-load-balancer.js:316:36)
    at /Users/james/Development/ortoo/api-service/node_modules/@ortoo/infra-grpc-client/node_modules/@ortoo/grpc-utils/node_modules/@grpc/grpc-js/build/src/picker.js:69:35 {
  input: 'http://::1:58440'
}

The problem is that the host part should be bracketed for ipv6 urls ([::1]), and the bug I think is in the dns resolver. I've tweaked it to always bracket ipv6 addresses in the same way as is done when resolving ipv6 addresses from an AAAA record (see here)

@thelinuxfoundation

Copy link
Copy Markdown

Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement.

After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.

Regards,
CLA GitHub bot

@murgatroid99 murgatroid99 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this.

@murgatroid99
murgatroid99 merged commit baaa479 into grpc:master Nov 22, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants