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

vmm: http: graceful shutdown of the http api thread #6248

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

alex-matei
Copy link
Contributor

This commit ensures that the HttpApi thread flushes all the responses before the application shuts down. Without this step, in case of a VmmShutdown request the application might terminate before the thread sends a response.

Fixes: #6247

@alex-matei alex-matei requested a review from a team as a code owner February 28, 2024 12:20
@rbradford
Copy link
Member

@alex-matei the CI configuration has changed so please rebase your work on the "main" branch

@alex-matei
Copy link
Contributor Author

@rbradford Done, rebased on top of main.

Copy link
Member

@rbradford rbradford 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 thanks!

vmm/src/lib.rs Outdated
@@ -455,25 +456,27 @@ pub fn start_vmm_thread(
None => None,
};

if let Some(http_path) = http_path {
api::start_http_path_thread(
let http_thread = if let Some(http_path) = http_path {
Copy link
Member

Choose a reason for hiding this comment

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

nit: I would have named this http_api_thread_handle so you don't need to alias it when you pass it to the function below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, I changed to http_api_handle.

// Retrieve seccomp filter for API thread
let api_seccomp_filter = get_seccomp_filter(seccomp_action, Thread::HttpApi, hypervisor_type)
.map_err(VmmError::CreateSeccompFilter)?;

thread::Builder::new()
let api_shutdown_fd = EventFd::new(libc::EFD_NONBLOCK).map_err(VmmError::EventFdCreate)?;

Copy link
Member

Choose a reason for hiding this comment

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

nit: Drop this line of whitespace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

This commit ensures that the HttpApi thread flushes all the responses
before the application shuts down. Without this step, in case of a
VmmShutdown request the application might terminate before the
thread sends a response.

Fixes: cloud-hypervisor#6247

Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
@rbradford rbradford added this pull request to the merge queue Feb 29, 2024
Merged via the queue into cloud-hypervisor:main with commit 1091494 Feb 29, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Cloud hypervisor might exit before all http replies are sent
2 participants