-
Notifications
You must be signed in to change notification settings - Fork 236
fix(iroh-dns-server): Fixes for packet expiry #3297
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
Conversation
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3297/docs/iroh/ Last updated: 2025-05-09T11:38:38Z |
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.
Yeah I don't mind the extra allocations for Timestamp
. I think this is better.
let expired = Timestamp::now() - expiry_us; | ||
if packet.timestamp() < expired { |
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.
Is there a way of essentially having this say now().duration_since(packet.timestamp()) > expiry_duration
instead?
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.
https://docs.rs/pkarr/latest/pkarr/struct.Timestamp.html doesn't provide this it seems.
Description
Based on #3295
I noticed in the debug logs of our staging server that some entries in the expiry table were never deleted, and thus they were processed again and again on each expiry tick.
This PR has the following changes:
existing.timestamp()
, because that's the entry we want to remove, not the (not-yet-existing) entry for the timestamp of the new packet.Breaking Changes
Notes & open questions
We need tests around expiry. This should've been caught earlier. There's currently only a single test around eviction, added in the PR that added eviction (#2997). But that test only tests that expiry works at all. There's no test currently that verifies if entries in the expiry table are removed when a packet is upserted, which is the test that would fail without this PR.
Change checklist