fix(swarm): prevent overflow in keep-alive computation#4644
fix(swarm): prevent overflow in keep-alive computation#4644mergify[bot] merged 11 commits intomasterfrom unknown repository
Conversation
mxinden
left a comment
There was a problem hiding this comment.
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?
mxinden
left a comment
There was a problem hiding this comment.
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.
thomaseizinger
left a comment
There was a problem hiding this comment.
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. |
thomaseizinger
left a comment
There was a problem hiding this comment.
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.
thomaseizinger
left a comment
There was a problem hiding this comment.
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.
mxinden
left a comment
There was a problem hiding this comment.
@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 [email protected]
Co-authored-by: Max Inden [email protected]
Notes & open questions
Change checklist