-
Notifications
You must be signed in to change notification settings - Fork 121
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
fix(rpc): Shut down the RPC server properly when Zebra shuts down #5591
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #5591 +/- ##
==========================================
+ Coverage 78.68% 78.74% +0.05%
==========================================
Files 305 305
Lines 38211 38328 +117
==========================================
+ Hits 30068 30182 +114
- Misses 8143 8146 +3 |
When i shut down zebra using this pull request (with and without
|
a14d263
to
5b9cd65
Compare
Good question! When you shut down But in the RUST_LOG=info cargo test --package zebra-rpc -- --nocapture | grep Stop When I do this I see lots of:
(You will also see panics, that's ok, some tests expect a panic.) The shutdown code is also triggered when a Zebra task has an error or finishes unexpectedly. You can see this happen by replacing any When I did that to: Line 160 in ff81432
I saw these Zebra logs:
I also made some changes to the code so we call |
make sense, thank you for the details. i tried all that and it is working for me now. |
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.
code looks good to me, i made some tests locally and seems to work ok.
Motivation
Zebra's RPC server sometimes crashes with memory errors during tests.
Closes #5532.
The shutdown is a bit slow (2 minutes?), but it's better than crashing.
Solution
std::thread
, to avoid tokio panics due to blocking executor shutdownsRelated cleanups:
Option<_>
from the sendrawtransaction channel typeThis PR also adds extra CHANGELOG info for the security fix.
Review
This is a high-priority potential security issue.
Reviewer Checklist