Skip to content

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

Merged
merged 5 commits into from
May 12, 2025

Conversation

Frando
Copy link
Member

@Frando Frando commented May 9, 2025

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:

  • Bugfix: When upserting a packet, we were not properly clearing the old expiry entry! This line is wrong: It should be existing.timestamp(), because that's the entry we want to remove, not the (not-yet-existing) entry for the timestamp of the new packet.
  • Improve type handling and debug formatting around expiry timestamps, to make logs better readable and be less error prone to bad type conversions
  • When an expiry entry is being processed, and the corresponding packet does not exist anymore, the expiry entry is deleted

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

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant: Would be relevant, but needs to come later.

@Frando Frando requested a review from rklaehn May 9, 2025 11:37
Copy link

github-actions bot commented May 9, 2025

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

Copy link

github-actions bot commented May 9, 2025

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: c25e32f

Copy link
Member

@matheus23 matheus23 left a 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.

Comment on lines +195 to 196
let expired = Timestamp::now() - expiry_us;
if packet.timestamp() < expired {
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

@n0bot n0bot bot added this to iroh May 9, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh May 9, 2025
Base automatically changed from Frando/fix-dns-server-backwardscompat to main May 12, 2025 12:08
@Frando Frando added this pull request to the merge queue May 12, 2025
Merged via the queue into main with commit 146f423 May 12, 2025
37 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants