Skip to content

xds client bootstrap file#20380

Merged
markdroth merged 1 commit intogrpc:masterfrom
markdroth:xds_client_bootstrap
Oct 11, 2019
Merged

xds client bootstrap file#20380
markdroth merged 1 commit intogrpc:masterfrom
markdroth:xds_client_bootstrap

Conversation

@markdroth
Copy link
Copy Markdown
Member

@markdroth markdroth commented Sep 26, 2019

This change is Reviewable

@markdroth markdroth added the release notes: no Indicates if PR should not be in release notes label Sep 26, 2019
@markdroth markdroth force-pushed the xds_client_bootstrap branch 2 times, most recently from 9e1c3ac to 368c72b Compare October 2, 2019 20:15
@markdroth markdroth force-pushed the xds_client_bootstrap branch from 7725666 to 99307ef Compare October 4, 2019 23:24
@markdroth markdroth marked this pull request as ready for review October 4, 2019 23:25
@markdroth
Copy link
Copy Markdown
Member Author

It looks like I need to revamp the error-handling here a bit. Please hold off on reviewing for now.

@markdroth
Copy link
Copy Markdown
Member Author

This is once again ready for review.

Copy link
Copy Markdown
Contributor

@AspirinSJL AspirinSJL left a comment

Choose a reason for hiding this comment

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

Reviewed 29 of 32 files at r1, 3 of 3 files at r2, 7 of 7 files at r3.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @apolcyn and @markdroth)


src/core/ext/filters/client_channel/xds/xds_api.cc, line 214 at r2 (raw file):

  envoy_api_v2_core_Node* node_msg =
      envoy_api_v2_DiscoveryRequest_mutable_node(request, arena.ptr());
  UniquePtr<char> build_version;

It's never used? Same below.


src/core/ext/filters/client_channel/xds/xds_bootstrap.h, line 70 at r2 (raw file):

  const char* server_uri() const { return server_uri_; }
  const InlinedVector<ChannelCreds, 1> channel_creds() const {

This can return a reference.


src/core/ext/filters/client_channel/xds/xds_bootstrap.cc, line 383 at r2 (raw file):

    case GRPC_JSON_NUMBER:
      result->type = MetadataValue::Type::DOUBLE;
      errno = 0;  // To distinguish error.

How is this intended to be used? I don't see any modification to its value.


src/core/ext/filters/client_channel/xds/xds_channel_secure.cc, line 80 at r2 (raw file):

      }
    }
    if (creds == nullptr) return nullptr;

Why don't we try finding the creds in args in this case?


src/core/ext/filters/client_channel/xds/xds_client.cc, line 1191 at r2 (raw file):

  if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
    gpr_log(GPR_INFO, "[xds_client %p: creating channel to %s", this,
            bootstrap_->server_uri());

This may cause crash.

  1. bootstrap_ may be null.
  2. bootstrap_->server_uri() may be null.

Copy link
Copy Markdown
Member Author

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

Reviewable status: 31 of 32 files reviewed, 5 unresolved discussions (waiting on @apolcyn and @AspirinSJL)


src/core/ext/filters/client_channel/xds/xds_api.cc, line 214 at r2 (raw file):

Previously, AspirinSJL (Juanli Shen) wrote…

It's never used? Same below.

We allocate the build_version string inside of PopulateNode(), but we need to avoid freeing it until after the protobuf is serialized below. This UniquePtr<> holds on to the string and frees it when it goes out of scope.

I've added a comment about this.


src/core/ext/filters/client_channel/xds/xds_bootstrap.h, line 70 at r2 (raw file):

Previously, AspirinSJL (Juanli Shen) wrote…

This can return a reference.

Good catch! Done.


src/core/ext/filters/client_channel/xds/xds_bootstrap.cc, line 383 at r2 (raw file):

Previously, AspirinSJL (Juanli Shen) wrote…

How is this intended to be used? I don't see any modification to its value.

strtod(3) modifies errno if it fails. See the man page for details.


src/core/ext/filters/client_channel/xds/xds_channel_secure.cc, line 80 at r2 (raw file):

Previously, AspirinSJL (Juanli Shen) wrote…

Why don't we try finding the creds in args in this case?

Because if the bootstrap file sets creds to a particular type and we don't know about that type, then we should fail instead of picking the wrong creds. Otherwise, it will be surprising to the user, because we will silently ignore what they told us to do.


src/core/ext/filters/client_channel/xds/xds_client.cc, line 1191 at r2 (raw file):

Previously, AspirinSJL (Juanli Shen) wrote…

This may cause crash.

  1. bootstrap_ may be null.
  2. bootstrap_->server_uri() may be null.

Good catch. Fixed.

Note that (2) is not a problem, because gpr_log() will format a null pointer as (null).

Copy link
Copy Markdown
Contributor

@AspirinSJL AspirinSJL left a comment

Choose a reason for hiding this comment

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

I didn't see the new commit; please push the new commit, thanks!

Reviewable status: 31 of 32 files reviewed, 5 unresolved discussions (waiting on @apolcyn and @AspirinSJL)

@markdroth
Copy link
Copy Markdown
Member Author

The changes were pushed in commit eea5c40. Maybe try reloading?

Copy link
Copy Markdown
Contributor

@AspirinSJL AspirinSJL left a comment

Choose a reason for hiding this comment

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

Oh now I can see, sorry..

Reviewable status: 28 of 32 files reviewed, 5 unresolved discussions (waiting on @apolcyn and @AspirinSJL)

Copy link
Copy Markdown
Contributor

@AspirinSJL AspirinSJL left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r4, 3 of 3 files at r5.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @apolcyn and @markdroth)


src/core/ext/filters/client_channel/xds/xds_api.cc, line 214 at r2 (raw file):

Previously, markdroth (Mark D. Roth) wrote…

We allocate the build_version string inside of PopulateNode(), but we need to avoid freeing it until after the protobuf is serialized below. This UniquePtr<> holds on to the string and frees it when it goes out of scope.

I've added a comment about this.

I think we should make the version string a member of some xds object. Then we can make the code here more straightforward, and we don't have to build the string for each request.

Copy link
Copy Markdown
Member Author

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @apolcyn and @AspirinSJL)


src/core/ext/filters/client_channel/xds/xds_api.cc, line 214 at r2 (raw file):

Previously, AspirinSJL (Juanli Shen) wrote…

I think we should make the version string a member of some xds object. Then we can make the code here more straightforward, and we don't have to build the string for each request.

Good idea. Done.

Copy link
Copy Markdown
Contributor

@AspirinSJL AspirinSJL left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r6.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @apolcyn)

@markdroth
Copy link
Copy Markdown
Member Author

Known issues: #20545 #18840 #20519 #20502

@markdroth markdroth force-pushed the xds_client_bootstrap branch from 8247d03 to 2afaec2 Compare October 10, 2019 14:24
@markdroth markdroth merged commit 3631950 into grpc:master Oct 11, 2019
@markdroth markdroth deleted the xds_client_bootstrap branch October 11, 2019 16:03
@nanahpang
Copy link
Copy Markdown
Contributor

Hi, Mark
Could you try to sync to head and then rebuild your PR? Jan has modified the build file before you merged. It is possible that you run the tests before Jan's change got merged, so you didn't see the
tests are broken. If that is the case, sync and rebuild will solve this problem.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release notes: no Indicates if PR should not be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants