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

fix(state-parts-dump-check): bound process_part by timeout #10215

Merged
merged 2 commits into from Nov 20, 2023

Conversation

ppca
Copy link
Contributor

@ppca ppca commented Nov 18, 2023

Problem:
Occasionally, the monitoring will be stuck. What happens is there are a few parts for which the process_part() is called, but never finished, i.e. not retried, not success, not failed.
My guess is that the get_part().await somehow is stuck waiting forever, and since there was no timeout bound for the process_part(), the tokio task that runs process_part could be hung forever, thus the monitoring app is stuck.
I tried making the task for part_id = 100 sleep for 1000000 seconds, and the program finishes all other parts except this one and hangs. This is similar to what I see on monitoring node.

Solution:
bound process_part by a timeout, and initiate retry if timeout passed. Thus no matter for which reason the task hangs, it will retry itself.

Note, the timeout is set to 10 mins because the timeout starts counting once the task is spawn, and counts real time instead of cpu time for the task, i.e. if this task is not running, time still elapse. So we need to make sure within timeout * MAX_RETRIES, we are able to finish processing all parts.

@ppca ppca requested a review from a team as a code owner November 18, 2023 22:56
@ppca ppca requested review from akhi3030 and nikurt and removed request for akhi3030 November 18, 2023 22:56
Copy link
Contributor

@nikurt nikurt left a comment

Choose a reason for hiding this comment

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

I don't know why would it hang, but restricting the execution time of those tasks is a good idea.


const MAX_RETRIES: u32 = 3;
const MAX_RETRIES: u32 = 5;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment why we shouldn't set this number to a very large number, like 1_000_000.

@ppca ppca enabled auto-merge November 20, 2023 16:39
@ppca ppca force-pushed the xiangyi/add_timeout_to_dump_monitoring branch from aa16ab2 to da2e312 Compare November 20, 2023 16:40
Copy link

codecov bot commented Nov 20, 2023

Codecov Report

Attention: 19 lines in your changes are missing coverage. Please review.

Comparison is base (1102b37) 71.88% compared to head (da2e312) 71.85%.

Files Patch % Lines
tools/state-parts-dump-check/src/cli.rs 0.00% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10215      +/-   ##
==========================================
- Coverage   71.88%   71.85%   -0.04%     
==========================================
  Files         707      707              
  Lines      141788   141796       +8     
  Branches   141788   141796       +8     
==========================================
- Hits       101927   101888      -39     
- Misses      35147    35196      +49     
+ Partials     4714     4712       -2     
Flag Coverage Δ
backward-compatibility 0.08% <0.00%> (-0.01%) ⬇️
db-migration 0.08% <0.00%> (-0.01%) ⬇️
genesis-check 1.23% <0.00%> (-0.01%) ⬇️
integration-tests 36.17% <0.00%> (-0.09%) ⬇️
linux 71.75% <0.00%> (-0.02%) ⬇️
linux-nightly 71.61% <0.00%> (-0.02%) ⬇️
macos 55.50% <0.00%> (+0.01%) ⬆️
pytests 1.46% <0.00%> (-0.01%) ⬇️
sanity-checks 1.26% <0.00%> (-0.01%) ⬇️
unittests 68.20% <0.00%> (-0.01%) ⬇️
upgradability 0.13% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ppca ppca added this pull request to the merge queue Nov 20, 2023
Merged via the queue into master with commit debc26a Nov 20, 2023
15 of 17 checks passed
@ppca ppca deleted the xiangyi/add_timeout_to_dump_monitoring branch November 20, 2023 17:32
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.

None yet

2 participants