udp: support forwarding packets between workers#13086
udp: support forwarding packets between workers#13086ggreenway merged 45 commits intoenvoyproxy:masterfrom
Conversation
Also, a few fixes in active_quic_listener that were discovered while fixing tests to work with this change. Signed-off-by: Greg Greenway <ggreenway@apple.com>
|
I took inspiration on this from the ConnectionBalancer code, since it's doing a similar operation. |
|
@lambdai @mattklein123 would the crash fixed in #12748 logically apply to this change as well? Eg, should I use a shared_ptr in the same way #12748 did? |
Signed-off-by: Greg Greenway <ggreenway@apple.com>
danzh2010
left a comment
There was a problem hiding this comment.
Nice packet re-route interface! I have some thought regarding to the QUIC fix. Overall looks good!
source/extensions/quic_listeners/quiche/active_quic_listener.cc
Outdated
Show resolved
Hide resolved
source/extensions/quic_listeners/quiche/active_quic_listener.cc
Outdated
Show resolved
Hide resolved
source/extensions/quic_listeners/quiche/active_quic_listener.cc
Outdated
Show resolved
Hide resolved
source/extensions/quic_listeners/quiche/active_quic_listener.cc
Outdated
Show resolved
Hide resolved
source/extensions/quic_listeners/quiche/active_quic_listener.cc
Outdated
Show resolved
Hide resolved
mattklein123
left a comment
There was a problem hiding this comment.
Thanks for working on this. Flushing out a few high level comments before diving into the detailed review.
/wait
source/extensions/quic_listeners/quiche/active_quic_listener.cc
Outdated
Show resolved
Hide resolved
the dispatcher for processing buffered chlos Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
mattklein123
left a comment
There was a problem hiding this comment.
LGTM at a high level. Flushing out a few more comments. Thank you!
/wait
source/extensions/quic_listeners/quiche/active_quic_listener.cc
Outdated
Show resolved
Hide resolved
source/extensions/quic_listeners/quiche/active_quic_listener.cc
Outdated
Show resolved
Hide resolved
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
|
ci failure due to disk full /retest |
|
Retrying Azure Pipelines, to retry CircleCI checks, use |
|
coverage error wasn't caused by this PR: |
danzh2010
left a comment
There was a problem hiding this comment.
LGTM, alone aside the renaming request. Also can you speak of #13086 (comment)?
| Network::UdpPacketWriterPtr udp_packet_writer = | ||
| std::make_unique<Quic::UdpGsoBatchWriter>(io_handle, scope); | ||
| return udp_packet_writer; | ||
| #if UDP_GSO_BATCH_WRITER_PLATFORM_SUPPORT |
There was a problem hiding this comment.
Right now GSO support is determined at runtime. But GSO code can also compile at the linux kernels that doesn't support it. I think what we want here is PLATFORM_SUPPORT_POSIX or something like that.
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Sorry, I missed that earlier. Replied. |
|
@mattklein123 can you give this a final pass/approval? |
mattklein123
left a comment
There was a problem hiding this comment.
Thanks this is really neat. Just a few small things from another pass through. Thank you!
/wait
| virtual ConnectionHandler::ActiveListenerPtr | ||
| createActiveUdpListener(ConnectionHandler& parent, Event::Dispatcher& disptacher, | ||
| Network::ListenerConfig& config) PURE; | ||
| createActiveUdpListener(uint32_t worker_id, ConnectionHandler& parent, |
There was a problem hiding this comment.
nit: worker_index, here and anywhere else we still have id. Also needs doc comment update.
| Network::UdpListenerCallbacks* udp_listener = | ||
| dynamic_cast<ActiveUdpListenerBase*>(details.listener_.get()); | ||
| ASSERT(udp_listener != nullptr); | ||
| details.typed_listener_ = *static_cast<Network::UdpListenerCallbacks*>(udp_listener); |
There was a problem hiding this comment.
Is this static cast needed? It's the type of the variable above?
There was a problem hiding this comment.
That must have been added during some previous variation. Removed.
| Network::UdpListenerCallbacks* udp_listener = | ||
| dynamic_cast<ActiveUdpListenerBase*>(details.listener_.get()); |
There was a problem hiding this comment.
Why is the dynamic_cast needed here? This seems bad? Can you add a TODO of some type to figure out how to clean this up?
IIRC there is some mess here that we have dealt with in the past around extensions actually implementing active listener base, etc.? Is that right? It would be good to have a comment if that is the case. I know I have commented on similar things in the past. I think possible if we make QUIC/QUICHE not extension based this gets better.
There was a problem hiding this comment.
Good point.
I fixed this by promoting part of ActiveUdpListenerBase to /include, so that the factory can return that type. No more casts needed. Take a look at the commit; I had to switch inheritance of ActiveListener to virtual. If we don't like that, the same can be accomplished by making ActiveListenerImplBase into a mixin template, or templatizing whether it inherits from ActiveListener or ActiveUdpListener. Either is fine with me.
| absl::variant<absl::monostate, std::reference_wrapper<ActiveTcpListener>, | ||
| std::reference_wrapper<Network::UdpListenerCallbacks>> | ||
| typed_listener_; |
There was a problem hiding this comment.
Just for my understanding, why do we need the variant? Is this just because it truly is a variant and it avoids multiple variables that are XOR? Maybe just add a small comment?
There was a problem hiding this comment.
It's just a safe union
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
needing unsafe dynamic_cast Signed-off-by: Greg Greenway <ggreenway@apple.com>
Signed-off-by: Greg Greenway <ggreenway@apple.com>
mattklein123
left a comment
There was a problem hiding this comment.
Epic, thanks for the cleanups!
Same on latest run |
Actually, it looks like the stub I added is counting against coverage: |
Signed-off-by: Greg Greenway <ggreenway@apple.com>
|
asan failure says /retest |
|
Retrying Azure Pipelines, to retry CircleCI checks, use |
Signed-off-by: Greg Greenway ggreenway@apple.com
Commit Message: Also, a few fixes in active_quic_listener that were discovered while fixing
tests to work with this change:
onData().Additional Description:
Risk Level: Medium
Testing: Fixed all existing tests; still need to add some new
Docs Changes:
Release Notes: This is mostly invisible to the user; will be used to build user-facing features later
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]