You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(iroh-dns-server): Fixes for packet expiry (#3297)
## 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](https://github.com/n0-computer/iroh/blob/f3c9af35542a7f2e00303090d1ca5273f86bc375/iroh-dns-server/src/store/signed_packets.rs#L148)
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
<!-- Optional, if there are any breaking changes document them,
including how to migrate older code. -->
## Notes & open questions
We need tests around expiry. This should've been caught earlier. There's
currently only a [single
test](https://github.com/n0-computer/iroh/blob/f3c9af35542a7f2e00303090d1ca5273f86bc375/iroh-dns-server/src/lib.rs#L190)
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
<!-- Remove any that are not relevant. -->
- [x] Self-review.
- [x] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- Tests if relevant: Would be relevant, but needs to come later.
0 commit comments