fix: mark all routers DoNotWaitForSearchValue (#10020)
* fix: mark ipns pubsub router DoNotWaitForSearchValue That means if the DHT has finished searching and no one responded over pubsub *yet*, we will not spend 1 minute searching for no reason. This also include other error handling bug fixes inside `go-libp2p-routing-helpers`. Fixes: #9927 * routing: bring back the old IPNS behaviour Stop making this configurable let everything race like it used to do.
Jorropo committed
Jul 25, 2023 at 19:39 UTC
9c02eecad7859d9b4424d0ee36c9e4658d090cf5
8 files changed
+39
-20
core/node/libp2p/routing.go
+4
-3
@@ -126,7 +126,7 @@ func BaseRouting(cfg *config.Config) interface{} {
126
return out, err
127
}
128
routers := []*routinghelpers.ParallelRouter{
129
- {Router: fullRTClient},
129
+ {Router: fullRTClient, DoNotWaitForSearchValue: true},
130
}
131
routers = append(routers, httpRouters...)
132
router := routinghelpers.NewComposableParallel(routers)
@@ -197,8 +197,9 @@ func Routing(in p2pOnlineRoutingIn) irouting.ProvideManyRouter {
197
var cRouters []*routinghelpers.ParallelRouter
198
for _, v := range routers {
199
cRouters = append(cRouters, &routinghelpers.ParallelRouter{
200
- IgnoreError: true,
201
- Router: v.Routing,
200
+ IgnoreError: true,
201
+ DoNotWaitForSearchValue: true,
202
+ Router: v.Routing,
203
})
204
}
205
core/node/libp2p/routingopt.go
+9
-7
@@ -61,10 +61,11 @@ func constructDefaultHTTPRouters(cfg *config.Config) ([]*routinghelpers.Parallel
61
}
62
63
routers = append(routers, &routinghelpers.ParallelRouter{
64
- Router: r,
65
- IgnoreError: true, // https://github.com/ipfs/kubo/pull/9475#discussion_r1042507387
66
- Timeout: 15 * time.Second, // 5x server value from https://github.com/ipfs/kubo/pull/9475#discussion_r1042428529
67
- ExecuteAfter: 0,
64
+ Router: r,
65
+ IgnoreError: true, // https://github.com/ipfs/kubo/pull/9475#discussion_r1042507387
66
+ Timeout: 15 * time.Second, // 5x server value from https://github.com/ipfs/kubo/pull/9475#discussion_r1042428529
67
+ DoNotWaitForSearchValue: true,
68
+ ExecuteAfter: 0,
69
})
70
}
71
return routers, nil
@@ -82,9 +83,10 @@ func ConstructDefaultRouting(cfg *config.Config, routingOpt RoutingOption) Routi
83
return nil, err
84
}
85
routers = append(routers, &routinghelpers.ParallelRouter{
85
- Router: dhtRouting,
86
- IgnoreError: false,
87
- ExecuteAfter: 0,
86
+ Router: dhtRouting,
87
+ IgnoreError: false,
88
+ DoNotWaitForSearchValue: true,
89
+ ExecuteAfter: 0,
90
})
91
92
httpRouters, err := constructDefaultHTTPRouters(cfg)
docs/changelogs/v0.22.md
+9
@@ -8,6 +8,7 @@
8
- [🔦 Highlights](#-highlights)
9
- [Gateway: support for `order=` and `dups=` parameters (IPIP-412)](#gateway-support-for-order-and-dups-parameters-ipip-412)
10
- [`ipfs name publish` now supports V2 only IPNS records](#ipfs-name-publish-now-supports-v2-only-ipns-records)
11
+ - [IPNS name resolution has been fixed](#ipns-name-resolution-has-been-fixed)
12
- [📝 Changelog](#-changelog)
13
- [👨👩👧👦 Contributors](#-contributors)
14
@@ -46,6 +47,14 @@ to V2 only in the future.
47
48
**TODO**: add links to IPIP https://github.com/ipfs/specs/issues/376
49
50
+#### IPNS name resolution has been fixed
51
+
52
+IPNS name resolution had a regression where if IPNS over PubSub was enabled, but the name was not also available via IPNS over PubSub it would take 1 minute to for the lookup to complete (if the record was not yet cached).
53
+
54
+This has been fixed and as before will give the best record from either the DHT subsystem or IPNS over PubSub, whichever comes back first.
55
+
56
+For details see [#9927](https://github.com/ipfs/kubo/issues/9927) and [#10020](https://github.com/ipfs/kubo/pull/10020).
57
+
58
### 📝 Changelog
59
60
### 👨👩👧👦 Contributors
docs/examples/kubo-as-a-library/go.mod
+2
-1
@@ -16,6 +16,7 @@ require (
16
require (
17
bazil.org/fuse v0.0.0-20200117225306-7b5117fecadc // indirect
18
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
19
+ github.com/Jorropo/jsync v1.0.1 // indirect
20
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
21
github.com/alexbrainman/goissue34681 v0.0.0-20191006012335-3fc7a47baff5 // indirect
22
github.com/benbjohnson/clock v1.3.5 // indirect
@@ -106,7 +107,7 @@ require (
107
github.com/libp2p/go-libp2p-pubsub v0.9.3 // indirect
108
github.com/libp2p/go-libp2p-pubsub-router v0.6.0 // indirect
109
github.com/libp2p/go-libp2p-record v0.2.0 // indirect
109
- github.com/libp2p/go-libp2p-routing-helpers v0.7.0 // indirect
110
+ github.com/libp2p/go-libp2p-routing-helpers v0.7.1 // indirect
111
github.com/libp2p/go-libp2p-xor v0.1.0 // indirect
112
github.com/libp2p/go-mplex v0.7.0 // indirect
113
github.com/libp2p/go-msgio v0.3.0 // indirect
docs/examples/kubo-as-a-library/go.sum
+4
-2
@@ -45,6 +45,8 @@ github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIo
45
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
46
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
47
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
48
+github.com/Jorropo/jsync v1.0.1 h1:6HgRolFZnsdfzRUj+ImB9og1JYOxQoReSywkHOGSaUU=
49
+github.com/Jorropo/jsync v1.0.1/go.mod h1:jCOZj3vrBCri3bSU3ErUYvevKlnbssrXeCivybS5ABQ=
50
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
51
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
52
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
@@ -502,8 +504,8 @@ github.com/libp2p/go-libp2p-pubsub-router v0.6.0 h1:D30iKdlqDt5ZmLEYhHELCMRj8b4s
504
github.com/libp2p/go-libp2p-pubsub-router v0.6.0/go.mod h1:FY/q0/RBTKsLA7l4vqC2cbRbOvyDotg8PJQ7j8FDudE=
505
github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
506
github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk=
505
-github.com/libp2p/go-libp2p-routing-helpers v0.7.0 h1:sirOYVD0wGWjkDwHZvinunIpaqPLBXkcnXApVHwZFGA=
506
-github.com/libp2p/go-libp2p-routing-helpers v0.7.0/go.mod h1:R289GUxUMzRXIbWGSuUUTPrlVJZ3Y/pPz495+qgXJX8=
507
+github.com/libp2p/go-libp2p-routing-helpers v0.7.1 h1:kc0kWCZecbBPAiFEHhxfGJZPqjg1g9zV+X+ovR4Tmnc=
508
+github.com/libp2p/go-libp2p-routing-helpers v0.7.1/go.mod h1:cHStPSRC/wgbfpb5jYdMP7zaSmc2wWcb1mkzNr6AR8o=
509
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
510
github.com/libp2p/go-libp2p-xor v0.1.0 h1:hhQwT4uGrBcuAkUGXADuPltalOdpf9aag9kaYNT2tLA=
511
github.com/libp2p/go-libp2p-xor v0.1.0/go.mod h1:LSTM5yRnjGZbWNTA/hRwq2gGFrvRIbQJscoIL/u6InY=
go.mod
+2
-1
@@ -52,7 +52,7 @@ require (
52
github.com/libp2p/go-libp2p-pubsub v0.9.3
53
github.com/libp2p/go-libp2p-pubsub-router v0.6.0
54
github.com/libp2p/go-libp2p-record v0.2.0
55
- github.com/libp2p/go-libp2p-routing-helpers v0.7.0
55
+ github.com/libp2p/go-libp2p-routing-helpers v0.7.1
56
github.com/libp2p/go-libp2p-testing v0.12.0
57
github.com/libp2p/go-socket-activation v0.1.0
58
github.com/mitchellh/go-homedir v1.1.0
@@ -91,6 +91,7 @@ require (
91
92
require (
93
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
94
+ github.com/Jorropo/jsync v1.0.1 // indirect
95
github.com/Kubuxu/go-os-helper v0.0.1 // indirect
96
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
97
github.com/alexbrainman/goissue34681 v0.0.0-20191006012335-3fc7a47baff5 // indirect
go.sum
+4
-2
@@ -47,6 +47,8 @@ github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIo
47
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
48
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
49
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
50
+github.com/Jorropo/jsync v1.0.1 h1:6HgRolFZnsdfzRUj+ImB9og1JYOxQoReSywkHOGSaUU=
51
+github.com/Jorropo/jsync v1.0.1/go.mod h1:jCOZj3vrBCri3bSU3ErUYvevKlnbssrXeCivybS5ABQ=
52
github.com/Kubuxu/go-os-helper v0.0.1 h1:EJiD2VUQyh5A9hWJLmc6iWg6yIcJ7jpBcwC8GMGXfDk=
53
github.com/Kubuxu/go-os-helper v0.0.1/go.mod h1:N8B+I7vPCT80IcP58r50u4+gEEcsZETFUpAzWW2ep1Y=
54
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
@@ -563,8 +565,8 @@ github.com/libp2p/go-libp2p-pubsub-router v0.6.0 h1:D30iKdlqDt5ZmLEYhHELCMRj8b4s
565
github.com/libp2p/go-libp2p-pubsub-router v0.6.0/go.mod h1:FY/q0/RBTKsLA7l4vqC2cbRbOvyDotg8PJQ7j8FDudE=
566
github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
567
github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk=
566
-github.com/libp2p/go-libp2p-routing-helpers v0.7.0 h1:sirOYVD0wGWjkDwHZvinunIpaqPLBXkcnXApVHwZFGA=
567
-github.com/libp2p/go-libp2p-routing-helpers v0.7.0/go.mod h1:R289GUxUMzRXIbWGSuUUTPrlVJZ3Y/pPz495+qgXJX8=
568
+github.com/libp2p/go-libp2p-routing-helpers v0.7.1 h1:kc0kWCZecbBPAiFEHhxfGJZPqjg1g9zV+X+ovR4Tmnc=
569
+github.com/libp2p/go-libp2p-routing-helpers v0.7.1/go.mod h1:cHStPSRC/wgbfpb5jYdMP7zaSmc2wWcb1mkzNr6AR8o=
570
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
571
github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg=
572
github.com/libp2p/go-libp2p-xor v0.1.0 h1:hhQwT4uGrBcuAkUGXADuPltalOdpf9aag9kaYNT2tLA=
routing/delegated.go
+5
-4
@@ -105,10 +105,11 @@ func parse(visited map[string]bool,
105
}
106
107
pr = append(pr, &routinghelpers.ParallelRouter{
108
- Router: ri,
109
- IgnoreError: cr.IgnoreErrors,
110
- Timeout: cr.Timeout.Duration,
111
- ExecuteAfter: cr.ExecuteAfter.WithDefault(0),
108
+ Router: ri,
109
+ IgnoreError: cr.IgnoreErrors,
110
+ DoNotWaitForSearchValue: true,
111
+ Timeout: cr.Timeout.Duration,
112
+ ExecuteAfter: cr.ExecuteAfter.WithDefault(0),
113
})
114
115
}