Skip to content

rpc: disable use of http proxies by default#55502

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
irfansharif:201007.grpc-ctx-join-rpc
Oct 13, 2020
Merged

rpc: disable use of http proxies by default#55502
craig[bot] merged 1 commit intocockroachdb:masterfrom
irfansharif:201007.grpc-ctx-join-rpc

Conversation

@irfansharif
Copy link
Copy Markdown
Contributor

GRPC uses the HTTPS_PROXY environment variable by default1. This is
surprising, and likely undesirable for CRDB because it turns the proxy
into an availability risk and a throughput bottleneck. We disable the
use of proxies by default when retrieving grpc dial options.

This diff came up in the context of #55289, and was a recent regression
in 20.2 after having introduced the join rpc in #52526 (it's the rpc
responsible for adding new nodes to the cluster #52526). Our existing
RPC connections use the WithContextDialer option already, which has the
side effect of disabling proxy use. The join RPC didn't, so an existing
cluster upgrade to 20.2 wouldn't use the proxy until a node was added.

Fixes #55289. This will need to get backported to release-20.2.

Release note: Previously we used the HTTPS_PROXY variable for the "join
RPC" when adding a node to the cluster (the RPC prevents new clusters
from starting or adding nodes to an existing cluster). The proxy needed
to configured to transparently pass HTTP/2+GRPC inter-node traffic. This
was an unintentional addition, and this patch ignores the proxies for
all intra-node traffic. They were already ignored in releases prior to
20.2.

@irfansharif irfansharif requested a review from bdarnell October 13, 2020 14:07
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@bdarnell bdarnell left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @irfansharif)


pkg/server/init.go, line 487 at r1 (raw file):

// successful, an initState is returned.
func (s *initServer) attemptJoinTo(ctx context.Context, addr string) (*initState, error) {
	// XXX: Ben, is this what you mean? What should be the added comment/commit

I believe this part of the change is unnecessary - s.config.dialOpts is initialized from Context.grpcDialOptions.

GRPC uses the HTTPS_PROXY environment variable by default[1]. This is
surprising, and likely undesirable for CRDB because it turns the proxy
into an availability risk and a throughput bottleneck. We disable the
use of proxies by default when retrieving grpc dial options.

This diff came up in the context of cockroachdb#55289, and was a recent regression
in 20.2 after having introduced the join rpc in cockroachdb#52526 (it's the rpc
responsible for adding new nodes to the cluster cockroachdb#52526). Our existing
RPC connections use the `WithContextDialer` option already, which has the
side effect of disabling proxy use. The join RPC didn't, so an existing
cluster upgrade to 20.2 wouldn't use the proxy until a node was added.

Fixes cockroachdb#55289. This will need to get backported to release-20.2.

[1]: https://github.com/grpc/grpc-go/blob/c0736608/Documentation/proxy.md

Release note (bug fix): Previously we used the HTTPS_PROXY variable for
the "join RPC" when adding a node to the cluster (the RPC prevents new
clusters from starting or adding nodes to an existing cluster). The
proxy needed to configured to transparently pass HTTP/2+GRPC inter-node
traffic. This was an unintentional addition, and this patch ignores the
proxies for all intra-node traffic. They were already ignored in
releases prior to 20.2.
@irfansharif irfansharif force-pushed the 201007.grpc-ctx-join-rpc branch from deb9242 to b25e3f7 Compare October 13, 2020 14:19
Copy link
Copy Markdown
Contributor Author

@irfansharif irfansharif left a comment

Choose a reason for hiding this comment

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

TFTR!

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @bdarnell)


pkg/server/init.go, line 487 at r1 (raw file):

Previously, bdarnell (Ben Darnell) wrote…

I believe this part of the change is unnecessary - s.config.dialOpts is initialized from Context.grpcDialOptions.

Woops, didn't mean to include that diff.

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Oct 13, 2020

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rpc: Reconsider HTTP proxy handling

4 participants