Skip to content

grpc: utilities for inter-converting grpc::ByteBuffer and Buffer::Instance.#6732

Merged
htuch merged 19 commits intoenvoyproxy:masterfrom
jplevyak:raw-grpc-common
May 10, 2019
Merged

grpc: utilities for inter-converting grpc::ByteBuffer and Buffer::Instance.#6732
htuch merged 19 commits intoenvoyproxy:masterfrom
jplevyak:raw-grpc-common

Conversation

@jplevyak
Copy link
Contributor

Signed-off-by: John Plevyak jplevyak@gmail.com

For an explanation of how to fill out the fields, please see the relevant section
in PULL_REQUESTS.md

Description: Add utilities for converting between grpc::ByteBuffer and Buffer::Instance and
for adding gRPC frame headers to Buffer::Instances. This is in support for proving raw
(Buffer::Instance) gRPC support which is in support of #4272. This PR also renames Grpc::Common::serializeBody
to Grpc::Common::serializeToGrpcFrame which is a better description of the actual behavior
as per comments on #6525,
Risk Level: low
Testing: Complete unit tests provided.
Docs Changes: N/A
Release Notes: N/A
[Optional Fixes #Issue]
[Optional Deprecated:]

…tance

and for adding gRPC frame headers to Buffer::Instances.

Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
@jplevyak
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: compile_time_options (failed build)
🔨 rebuilding ci/circleci: coverage (failed build)

🐱

Caused by: a #6732 (comment) was created by @jplevyak.

see: more, trace.

Copy link
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

Great, a couple of style nits and some questions.

Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Looks good in general, a bunch of comments, mostly nits but a few thread related ones as well.
/wait

delete container;
}
};
// NB: addBufferFragment takes a pointer alias to the BufferFragmentImpl which is passed in so we
Copy link
Member

Choose a reason for hiding this comment

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

Can we just make fragments_ a unique_ptr and have it follow RAII?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I make it container->fragments_ = std::make_uniqueBuffer::BufferFragmentImpl[](slices.size());
Then I get an error because BufferFragmentImpl is not copyable:

unique_ptr.h:831:34: error: no matching constructor for initialization of 'remove_extent_t<Envoy::Buffer::BufferFragmentImpl []> []'

buffer_impl.h:430:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided

Could you suggest an alternative?

Copy link
Member

Choose a reason for hiding this comment

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

Can BufferFragmentImpl be made copyable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but it was explicitly made NonCopyable because it is aliased by OwnedImpl, and therefore copying it could break the pointer from OwnedImpl, so I understand why it was made NonCopyable and I believe it needs to stay that way.

Any other ideas?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In response to: "Can you elaborate?":

The BufferFragmentImpl is not owned by the OwnedImpl, instead it takes a reference to it, so allowing the BufferFragmentImpl to move could result in hard to find bugs if someone erroneously thought that implied that it was a value type as opposed to what it is: something with strong address-based identity.

Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
jplevyak added 5 commits May 6, 2019 11:39
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
…-grpc-common

Signed-off-by: John Plevyak <jplevyak@gmail.com>
Copy link
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

Mostly style nits.

jplevyak added 3 commits May 6, 2019 19:34
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
@jplevyak
Copy link
Contributor Author

jplevyak commented May 7, 2019

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: asan (failed build)
🔨 rebuilding ci/circleci: release (failed build)

🐱

Caused by: a #6732 (comment) was created by @jplevyak.

see: more, trace.

@jplevyak
Copy link
Contributor Author

jplevyak commented May 7, 2019

OK, the tests now pass (except for the asan which I believe is unrelated).

PTAL

@lizan
Copy link
Member

lizan commented May 7, 2019

also, merging master would fix asan.

jplevyak added 5 commits May 8, 2019 17:20
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Signed-off-by: John Plevyak <jplevyak@gmail.com>
…-grpc-common

Signed-off-by: John Plevyak <jplevyak@gmail.com>
@jplevyak
Copy link
Contributor Author

jplevyak commented May 9, 2019

also, merging master would fix asan.

Done.

lizan
lizan previously approved these changes May 9, 2019
@htuch
Copy link
Member

htuch commented May 9, 2019

We could, but it was explicitly made NonCopyable because it is aliased by OwnedImpl, and therefore copying it could break the pointer from OwnedImpl, so I understand why it was made NonCopyable and I believe it needs to stay that way.

Re: this comment, I'm not sure I grok the "aliased by OwnedImpl" bit. Can you elaborate?

@htuch htuch added the waiting label May 9, 2019
Signed-off-by: John Plevyak <jplevyak@gmail.com>
Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Great, thanks, appreciate your patience working through these issues.

@htuch htuch merged commit d18b461 into envoyproxy:master May 10, 2019
mpuncel added a commit to mpuncel/envoy that referenced this pull request May 10, 2019
* master: (88 commits)
  upstream: Null-deref on TCP health checker if setsockopt fails  (envoyproxy#6793)
  ci: switch macOS CI to azure pipelines (envoyproxy#6889)
  os syscalls lib: break apart syscalls used for hot restart (envoyproxy#6880)
  Kafka codec: precompute request size before serialization, so we do n… (envoyproxy#6862)
  upstream: move static and strict_dns clusters to dedicated files (envoyproxy#6886)
  Rollforward of api: Add total_issued_requests to Upstream Locality and Endpoint Stats. (envoyproxy#6692) (envoyproxy#6784)
  fix explicit constructor in copy-initialization (envoyproxy#6884)
  stats: use tag iterator rather than constructing the tag-array and searching that. (envoyproxy#6853)
  common: use unscoped build target in generate_version_linkstamp (envoyproxy#6877)
  Addendum to envoyproxy#6778 (envoyproxy#6882)
  ci: add minimum Linux build for Azure Pipelines (envoyproxy#6881)
  grpc: utilities for inter-converting grpc::ByteBuffer and Buffer::Instance. (envoyproxy#6732)
  upstream: allow excluding hosts from lb calculations until initial health check (envoyproxy#6794)
  stats: prevent unused counters from leaking across hot restart (envoyproxy#6850)
  network filters: add `injectDataToFilterChain(data, end_stream)` method to network filter callbacks (envoyproxy#6750)
  delete things that snuck back in (envoyproxy#6873)
  config: scoped rds (2b): support delta APIs in ConfigProvider framework (envoyproxy#6781)
  string == string! (envoyproxy#6868)
  config: add mssing imports to delta_subscription_state (envoyproxy#6869)
  protobuf: add missing default case to enum (envoyproxy#6870)
  ...

Signed-off-by: Michael Puncel <mpuncel@squareup.com>
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.

3 participants