Router Info Prematurely Expired for Connected Routers.
For flood fill routers, the Router Info is expired when the peer hasn't updated the Router Info for the last 60 minutes, under the assumption that a flood fill will always get new Router Info for good peers within that time period.
However, on my testing network, I see numerous instances where Router Info for good peers is not updated in that time frame. The Router Info can be expired while the peer is still connected with active tunnels, leaving the tunnels with peers marked 'unreachable'.
I suggest fixing this by checking if the peer is connected before expiring the Router Info.
Another option would be to extend the time-out period. But it's still a good idea to check if a router is connected before expiring their router info.
Here's a suggested patch:
From: obscuratus <obscuratus@mail.i2p>
Date: Sat, 30 Apr 2022 08:57:00 -0500
Subject: [PATCH] NetDB: Don't Expire Router Info for Connected Peers.
Floodfills have a more aggressive time out period for expiration
of router info, which can have the consequence of expiring
the router info of peers that are currently connected.
Check for connected peers before expiring their router info.
Signed-off-by: obscuratus <obscuratus@mail.i2p>
---
.../kademlia/KademliaNetworkDatabaseFacade.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java b/router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java
index 9636b9188..780542781 100644
--- a/router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java
+++ b/router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java
@@ -1179,7 +1179,14 @@ public abstract class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacad
if (upLongEnough && !routerInfo.isCurrent(adjustedExpiration)) {
long age = _context.clock().now() - routerInfo.getPublished();
int existing = _kb.size();
- if (existing >= MIN_REMAINING_ROUTERS) {
+ if (_context.commSystem().isEstablished(routerInfo.getIdentity().getHash())) {
+ // Skip expiration of router info for connected peers.
+ if (_log.shouldLog(Log.DEBUG))
+ _log.debug("Peer " + routerInfo.getIdentity().getHash()
+ + " has expired Router Info ( "
+ + DataHelper.formatDuration(age)
+ + " ), but we are still connected.");
+ } else if (existing >= MIN_REMAINING_ROUTERS) {
if (_log.shouldLog(Log.INFO))
_log.info("Expired RI " + routerInfo.getIdentity().getHash(), new Exception());
return "Peer expired " + DataHelper.formatDuration(age) + " ago";
--
2.35.1