Perhaps fix an overflow bug relate to timer #426
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello, I find a bug relates to timer system and try to fix it, which causes overflow task to execute and all of the other tasks to fail. The system will crash and the battery is quickly exhausted (not "slightly higher runtime cost" in the comments of code author in the function because 'remaining' will always be negative and cannot be corrected). The following code can trigger bugs,
then you can see that the node is always running at full capacity, it will run the timer task with bugs forever.
Although the code author noticed the overflow problem, he/she did not solve it.
This problem appears to have been triggered in an early CTP protocol, but it has not really been resolved in underlying. [ 11ff964 ]
The idea my fix is to disable the timer that triggered the bug so that timer with the bug can not influent each other task. In this case, other tasks in the system can handle events normally, and the battery won't be drained quickly.