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
When running geth with a dns discovery setting where there set of nodes in the crawled public set is empty, the dns client goes into a spinloop, consuming 100% of a CPU core.
Testcase to repro this, where the last it.Next() spins :
diff --git a/p2p/dnsdisc/client_test.go b/p2p/dnsdisc/client_test.go
index 6a6705abf2..7be13176db 100644
--- a/p2p/dnsdisc/client_test.go+++ b/p2p/dnsdisc/client_test.go@@ -115,6 +115,21 @@ func TestIterator(t *testing.T) {
checkIterator(t, it, nodes)
}
+// This test checks that randomIterator finds all entries.+func TestEmptyIterator(t *testing.T) {+ tree, url := makeTestTree("n", testNodes(nodesSeed1, 00), nil)+ c := NewClient(Config{+ Resolver: mapResolver(tree.ToTXT("n")),+ Logger: testlog.Logger(t, log.LvlTrace),+ RateLimit: 500,+ })+ it, err := c.NewIterator(url)+ if err != nil {+ t.Fatal(err)+ }+ it.Next()+}+
// This test checks if closing randomIterator races.
func TestIteratorClose(t *testing.T) {
nodes := testNodes(nodesSeed1, 500)
Can also be tested live using e.g. geth --goerli --syncmode=snap.
The text was updated successfully, but these errors were encountered:
In the random sync algorithm used by the DNS node iterator, we first pick a random
tree and then perform one sync action on that tree. This happens in a loop until any
node is found. If no trees contain any nodes, the iterator will enter a hot loop spinning
at 100% CPU.
The fix is complicated. The iterator now checks if a meaningful sync action can
be performed on any tree. If there is nothing to do, it waits for the next root record
recheck time to arrive and then tries again.
Fixes#22306
When running geth with a dns discovery setting where there set of nodes in the crawled public set is empty, the dns client goes into a spinloop, consuming 100% of a CPU core.
Testcase to repro this, where the last
it.Next()
spins :Can also be tested live using e.g.
geth --goerli --syncmode=snap
.The text was updated successfully, but these errors were encountered: