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

extension: User space io socket #14917

Merged
merged 23 commits into from
Mar 2, 2021
Merged

extension: User space io socket #14917

merged 23 commits into from
Mar 2, 2021

Conversation

lambdai
Copy link
Contributor

@lambdai lambdai commented Feb 2, 2021

Commit Message:
Userspace io socket, cont
Introduce user space io socket handle on top of user space event at #14712

Userspace Io socket handles are always created with a peering handle.
The write() methods populate the buffer in the peer handle.
The read() methods consume the owned buffer.

Extracted from #13418

Signed-off-by: Yuchen Dai silentdai@gmail.com

Additional Description:
Risk Level: LOW, extension
Testing: Unit test
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@lambdai
Copy link
Contributor Author

lambdai commented Feb 2, 2021

/assign @antoniovicente

Copy link
Contributor

@antoniovicente antoniovicente left a comment

Choose a reason for hiding this comment

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

First pass. Sorry for not getting to this earlier.

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Copy link
Contributor Author

@lambdai lambdai left a comment

Choose a reason for hiding this comment

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

Partial fix

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@lambdai
Copy link
Contributor Author

lambdai commented Feb 10, 2021

@antoniovicente All comments resolved.
Recent updates include using Factory to create pair of handles, and not throwing exception in local/remote address methods

source/extensions/io_socket/user_space/io_handle_impl.cc Outdated Show resolved Hide resolved
source/extensions/io_socket/user_space/io_handle_impl.cc Outdated Show resolved Hide resolved
source/extensions/io_socket/user_space/io_handle_impl.cc Outdated Show resolved Hide resolved
source/extensions/io_socket/user_space/io_handle_impl.cc Outdated Show resolved Hide resolved
@@ -286,13 +293,11 @@ Api::SysCallIntResult IoHandleImpl::setBlocking(bool) { return makeInvalidSyscal
absl::optional<int> IoHandleImpl::domain() { return absl::nullopt; }

Network::Address::InstanceConstSharedPtr IoHandleImpl::localAddress() {
// TODO(lambdai): Rewrite when caller accept error as the return value.
throw EnvoyException(fmt::format("getsockname failed for IoHandleImpl"));
return IoHandleImpl::getCommonInternalAddress();
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems odd. All internal handles have the same address, no way to log which is which.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure how can this address be used....
This address doesn't provide the ability to connect to or listen. The connection socket could use AddressProvider to set the view of local address and remote address anyway

Copy link
Contributor

Choose a reason for hiding this comment

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

The address may be useful in logs to tell what is connected to what.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's leave it to the next phase when we do pass a reasonable address to IoHandleImpl

source/extensions/io_socket/user_space/io_handle_impl.h Outdated Show resolved Hide resolved
source/extensions/io_socket/user_space/io_handle_impl.h Outdated Show resolved Hide resolved
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
antoniovicente
antoniovicente previously approved these changes Feb 13, 2021
Copy link
Contributor

@antoniovicente antoniovicente left a comment

Choose a reason for hiding this comment

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

cc @envoyproxy/senior-maintainers

I think changes look good. I think this PR is ready for review by a non-googler senior maintainer.

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
antoniovicente
antoniovicente previously approved these changes Feb 17, 2021
@antoniovicente
Copy link
Contributor

/retest

Windows CI looks like an unrelated flaky issue. These new libraries are not linked into the failing test.

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #14917 (comment) was created by @antoniovicente.

see: more, trace.

@ggreenway ggreenway self-assigned this Feb 24, 2021
Copy link
Contributor

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

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

This looks great overall.

/wait


Api::IoCallUint64Result IoHandleImpl::read(Buffer::Instance& buffer,
absl::optional<uint64_t> max_length_opt) {
// Below value comes from Buffer::OwnedImpl::default_read_reservation_size_.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to expose this value somehow and use it from OwnedImpl. Otherwise this may get out of sync at some point, which will be easy to not notice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am creating an issue to track the next step.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

source/extensions/io_socket/user_space/io_handle_impl.cc Outdated Show resolved Hide resolved
@lambdai
Copy link
Contributor Author

lambdai commented Feb 26, 2021

merging main

Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
Signed-off-by: Yuchen Dai <silentdai@gmail.com>
@lambdai
Copy link
Contributor Author

lambdai commented Mar 1, 2021

gentle ping @ggreenway

@ggreenway ggreenway merged commit 56eb1e2 into envoyproxy:main Mar 2, 2021
@lambdai
Copy link
Contributor Author

lambdai commented Mar 2, 2021

Thank you!

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