-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Api server thread clean shutdown #3348
Api server thread clean shutdown #3348
Conversation
Thank you for the contribution, looks like a good change. |
Hi @acatangiu , Thank you very much for your contribution and sorry for the late turnaround. |
Hi @acatangiu do you want to rebase this PR on top of main or do you want me to do that? |
Yes, feel free to do it, thank you! |
96d8b6c
to
a79d06e
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3348 +/- ##
==========================================
+ Coverage 82.26% 82.28% +0.02%
==========================================
Files 225 225
Lines 28466 28457 -9
==========================================
- Hits 23417 23416 -1
+ Misses 5049 5041 -8
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
1ad413e
to
30fbaf4
Compare
a98a0d0
to
cc2dea9
Compare
4f3cd70
to
93738e3
Compare
93738e3
to
915fab8
Compare
Added shutdown event-fd acting as a kill switch. Used to signal the api server thread that it needs to shut down. Signed-off-by: Egor Lazarchuk <[email protected]> Co-authored-by: acatangiu <[email protected]>
915fab8
to
9d53e04
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ShadowCurse It is not clear to me why we need try_connect
, what is the problem with using UnixStream::connect
where we used it originally?
@JonathanWoollett-Light I did not change the PR. I just rebased it on top of main and fixed merge conflicts. |
9d53e04
to
35e563a
Compare
Is there anything we can do to fix this? |
Use dedicated kill switch mechanism to break out of micro-http loop and gracefully shutdown the API server thread. Remove hacky "/shutdown-internal" HTTP request which was externally exposing a way to bring down parts of firecracker components. Signed-off-by: Egor Lazarchuk <[email protected]> Co-authored-by:: acatangiu <[email protected]>
35e563a
to
2160cc2
Compare
Iirc I added this “try_connect” just for tests to make sure tests don’t sporadically fail based on different thread scheduling on different machines. At some point I know for sure tests would sporadically fail when test thread tried to connect to api thread before api thread had the chance to create the socket. Not sure if this is still a problem anymore, but I would still keep “try_connect” as defensive programming. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Changes
Use dedicated kill switch mechanism to break out of micro-http loop and gracefully shutdown the API server thread.
Remove hacky "/shutdown-internal" HTTP request which was externally exposing a way to bring down parts of firecracker components.
Dependencies
Ideally needs firecracker-microvm/micro-http#33 merged first, then point the dependency there.
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.
PR Checklist
git commit -s
).If a specific issue led to this PR, this PR closes the issue.Newunsafe
code is documented.API changes follow the Runbook for Firecracker API changes.User-facing changes are mentioned inCHANGELOG.md
.NewTODO
s link to an issue.This functionality can be added inrust-vmm
.