-
Notifications
You must be signed in to change notification settings - Fork 957
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(swarm): prevent overflow in keep-alive computation #4644
Conversation
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.
Thank you for the fast turnaround time. Overall looks good to me.
@thomaseizinger mind taking a look given that this is quite subtle?
@zrus can you add an entry to swarm/CHANGELOG.md
?
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.
Thank you for the follow-up. Again, let's give Thomas a chance to review. The more eyes on this subtle code path, the better.
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.
Thanks! Embarrassing that we didn't catch this in the first patch.
I'd like to test this better. In #4595, we are extracting this big code block into a function. Would you be up for copying that to this PR and writing some prop-tests using quickcheck
for it?
I have done it. But I have not added any tests yet. Please help me on this. |
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.
Thanks!
Regarding tests, are you familiar with quickcheck? https://github.com/BurntSushi/quickcheck
I have not used it before. Could you guide me? |
Sure! You'll like this :) The idea of You can find an example test in the To write your own test, you need to create a We'll need a couple of things:
That should get us started. We can then think about whether we want to permute the existing |
Tagging @leonzchang for visibility of related effort. We cherry-picked some of your code to make testing this easier :) I added you as a co-author to the PR description to correctly attribute your contribution! |
This pull request has merge conflicts. Could you please resolve them @zrus? 🙏 |
In order to unblock #4625, I am looking into the quickcheck test right now. |
Panic reproduced with test without patch.
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.
Thank you for your work!
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.
Thanks @mxinden !
Added some ideas that we can tackle in a follow-up :)
@mxinden There are merge conflicts unfortunately. |
…ix/idle_connection_timeout
Approvals have been dismissed because the PR was updated after the send-it
label was applied.
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.
@thomaseizinger assuming that with all comments addressed, you are fine with me merging here.
Approvals have been dismissed because the PR was updated after the send-it
label was applied.
I apologize for disappearing suddenly from last conversation about the test. I was too busy last week. And thank both of you, @thomaseizinger, @mxinden, for the great work and being patient with me. |
No worries at all! Normally nothing is super urgent but we wanted to start the next breaking release and this felt important enough to be patched before that :) |
Description
Add safe check to prevent
Delay::reset()
panic when duration overflow.Fixes: #4641.
Attributions
Co-authored-by: Leonz bellerophon00530@gmail.com
Co-authored-by: Max Inden mail@max-inden.de
Notes & open questions
Change checklist