Skip to content

Register HotRestartingParent as udp forwarding packet recipient - #29369

Merged
ravenblackx merged 18 commits into
envoyproxy:mainfrom
ravenblackx:hot_restart_shutdown
Sep 12, 2023
Merged

ravenblackx merged 18 commits into
envoyproxy:mainfrom
ravenblackx:hot_restart_shutdown

Conversation

@ravenblackx

@ravenblackx ravenblackx commented Aug 31, 2023 •

Copy link
Copy Markdown
Contributor

Commit Message: Register HotRestartingParent as udp forwarding packet recipient
Additional Description: When listeners start draining during hot restart, pass them a reference to HotRestartingParent so that ActiveQuicListeners can forward non-routable UDP packets to the child instance.
Risk Level: Low, no behaviors are actually changed yet.
Testing: Existing coverage should cover all touched paths (except the TODO one).
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a

@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #29369 was opened by ravenblackx.

see: more, trace.

Signed-off-by: Raven Black <[email protected]>
@ravenblackx ravenblackx mentioned this pull request Sep 1, 2023
6 tasks done
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
Signed-off-by: Raven Black <[email protected]>
@danzh2010

Copy link
Copy Markdown
Contributor

This is still a draft? Do you mean to actually send it out for review?

@ravenblackx
ravenblackx marked this pull request as ready for review September 7, 2023 14:43
@ravenblackx

Copy link
Copy Markdown
Contributor Author

This is still a draft? Do you mean to actually send it out for review?

I did.

Signed-off-by: Raven Black <[email protected]>
@ravenblackx ravenblackx changed the title [WIP] Register HotRestartingParent as udp forwarding packet recipient Register HotRestartingParent as udp forwarding packet recipient Sep 8, 2023
Comment thread source/server/server.cc Outdated
listener_manager_->stopListeners(ListenerManager::StopListenersType::All);
Network::ExtraShutdownListenerOptions empty_options;
listener_manager_->stopListeners(ListenerManager::StopListenersType::All,
options.has_value() ? *options : empty_options);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nits: s/empty_options/{}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

initializer_list cannot be used on right hand side of operator :

@ravenblackx ravenblackx Sep 11, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Worked with Network::ExtraShutdownListenerOptions{} though, and in all the other locations {}. I thought it didn't like it when you pass inline-constructed things as references, I guess maybe I'm mixing that up with some test context.

void HotRestartingParent::Internal::drainListeners() { server_->drainListeners(); }
void HotRestartingParent::Internal::drainListeners() {
Network::ExtraShutdownListenerOptions options;
options.non_dispatched_udp_packet_handler_ = *this;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a hot restarting test verifies that non_dispatched_udp_packet_handler_ is not nullopt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated a test to do this.

Comment on lines -3343 to -3347
manager_->stopListeners(ListenerManager::StopListenersType::All, empty_options);
EXPECT_EQ(1, server_.stats_store_.counterFromString("listener_manager.listener_stopped").value());
manager_->stopListeners(ListenerManager::StopListenersType::All, {);
EXPECT_EQ(1,
server_.stats_store_.counterFromString("listener_manager.listener_stopped").value());

// Validate that adding a listener is not allowed after all listeners are stopped.
const std::string listener_bar_yaml = R"EOF(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Something wrong with the formatting in this file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Doh, typo.

}
Signed-off-by: Raven Black <[email protected]>

@danzh2010 danzh2010 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@RyanTheOptimist RyanTheOptimist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wow, this is incredibly clean! There's a lot of plumbing here, but it seems mostly mechanical. Thanks for splitting this work into easily digestible pieces!

@@ -222,7 +222,8 @@ class ListenerManager {
* listeners on workers. Once a listener is stopped, any listener modifications are not allowed.
* @param stop_listeners_type indicates listeners to stop.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Can we add options to this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@RyanTheOptimist RyanTheOptimist self-assigned this Sep 12, 2023
Signed-off-by: Raven Black <[email protected]>
@ravenblackx
ravenblackx merged commit 9e8067d into envoyproxy:main Sep 12, 2023
@ravenblackx
ravenblackx deleted the hot_restart_shutdown branch September 12, 2023 21:05
mum4k pushed a commit to envoyproxy/nighthawk that referenced this pull request Sep 18, 2023
- No change to  `.bazelversion`.
- Synced changes from `.bazelrc`, `ci/run_envoy_docker.sh`, `tools/code_format/config.yaml`, `tools/gen_compilation_database.py`.
- Update the function signature of `drainListeners()` in [source/client/process_impl.cc](https://github.com/envoyproxy/nighthawk/blob/main/source/client/process_impl.cc) to accommodate envoyproxy/envoy#29369.

Signed-off-by: jiajunye [[email protected]](mailto:[email protected])
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