check-dnsseeds hangs on MacOS
laanwj opened this issue · comments
See #116 (comment)
$ ./check-dnsseeds.py
* Mainnet
OK seed.bitcoin.sipa.be (39 results)
OK dnsseed.bluematt.me (31 results)
OK dnsseed.bitcoin.dashjr.org (36 results)
OK seed.bitcoinstats.com (37 results)
OK seed.bitcoin.jonasschnelli.ch (37 results)
OK seed.btc.petertodd.org (37 results)
OK seed.bitcoin.sprovoost.nl (36 results)
OK dnsseed.emzy.de (29 results)
OK seed.bitcoin.wiz.biz (31 results)
* Testnet
OK testnet-seed.bitcoin.jonasschnelli.ch (23 results)
OK seed.tbtc.petertodd.org (38 results)
OK testnet-seed.bluematt.me (6 results)
OK seed.testnet.bitcoin.sprovoost.nl (34 results)
$ vim check-dnsseeds.py
$ git diff
diff --git a/check-dnsseeds.py b/check-dnsseeds.py
index 32b6ef1..700dd19 100755
--- a/check-dnsseeds.py
+++ b/check-dnsseeds.py
@@ -7,7 +7,7 @@ import subprocess
SEEDS_MAINNET=["seed.bitcoin.sipa.be","dnsseed.bluematt.me","dnsseed.bitcoin.dashjr.org",
"seed.bitcoinstats.com","seed.bitcoin.jonasschnelli.ch","seed.btc.petertodd.org",
- "seed.bitcoin.sprovoost.nl", "dnsseed.emzy.de","seed.bitcoin.wiz.biz"]
+ "seed.bitcoin.sprovoost.ne", "dnsseed.emzy.de","seed.bitcoin.wiz.biz"]
SEEDS_TESTNET=["testnet-seed.bitcoin.jonasschnelli.ch","seed.tbtc.petertodd.org",
"testnet-seed.bluematt.me","seed.testnet.bitcoin.sprovoost.nl"]
$ ./check-dnsseeds.py
* Mainnet
OK seed.bitcoin.sipa.be (39 results)
OK dnsseed.bluematt.me (31 results)
OK dnsseed.bitcoin.dashjr.org (36 results)
OK seed.bitcoinstats.com (37 results)
OK seed.bitcoin.jonasschnelli.ch (37 results)
OK seed.btc.petertodd.org (37 results)
FAIL seed.bitcoin.sprovoost.ne
OK dnsseed.emzy.de (29 results)
OK seed.bitcoin.wiz.biz (31 results)
* Testnet
OK testnet-seed.bitcoin.jonasschnelli.ch (23 results)
OK seed.tbtc.petertodd.org (38 results)
OK testnet-seed.bluematt.me (6 results)
OK seed.testnet.bitcoin.sprovoost.nl (34 results)
$ echo $?
0
$ uname -a
Darwin HOSTNAME 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64 x86_64
$ sw_vers
ProductName: macOS
ProductVersion: 12.1
BuildVersion: 21C52
$
edited: removed host name
ugh yeah wrote this on an obsolete default branch
replayed everything on the new default branch, to same results
check-dnsseeds questionably exits 0 even if no seed is reachable
check-dnsseeds questionably exits 0 even if no seed is reachable
Yes, i've never really used its exit status. There's no standard way to report "it's mostly OK" exit status. Could define a convention and document it, but I'm not sure anyone is using this script in any kind of programmatic monitoring way.
As for on topic, we might want to use Python module dns.resolver
(as also used by makeseeds.py
) instead of calling out to host
at some point. This introduces a dependency, but removes the impact of platform specific tool difference.
no, better have them parsing the output
sorry for the noise
no, better have them parsing the output
sorry for the noise
$ ./check-dnsseeds.py | \
sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' | \
awk 'BEGIN {sum_ok=0; sum_fail=0} {if ($1 == "OK") sum_ok += 1; if ($1 == "FAIL") sum_fail += 1} END {print "OK: ", sum_ok, "\nFAIL: ", sum_fail}'
OK: 14
FAIL: 0
$
back on topic: this does not really hang, does it?
can close...
... or rename to "remove host
for Python module dns.resolver".
My host
is not under a .../local/... dir, I don't think my system is affected of package manager taint for this command.
Took only a few seconds on macOS 12.3.1 with using the latest main branch, on two different machines (Python 3.9.10 and 3.10.0).
% ./check-dnsseeds.py
* mainnet
OK seed.bitcoin.sipa.be (39 results)
OK dnsseed.bluematt.me (31 results)
OK dnsseed.bitcoin.dashjr.org (36 results)
OK seed.bitcoinstats.com (37 results)
OK seed.bitcoin.jonasschnelli.ch (37 results)
OK seed.btc.petertodd.org (37 results)
OK seed.bitcoin.sprovoost.nl (36 results)
OK dnsseed.emzy.de (31 results)
OK seed.bitcoin.wiz.biz (31 results)
* testnet
OK testnet-seed.bitcoin.jonasschnelli.ch (23 results)
OK seed.tbtc.petertodd.org (38 results)
OK testnet-seed.bluematt.me (6 results)
OK seed.testnet.bitcoin.sprovoost.nl (34 results)
* signet
OK seed.signet.bitcoin.sprovoost.nl (15 results)
P.S. it should probably explicitly check reachability via IPv4 and IPv6 as well whether it returns both IPv4 and IPv6 entries. But don't fail if one is missing, as I'm not sure all seeds support IPv6 reachability, and not everyone running this script will have IPv6 access.
Thanks for testing. Closing.
Sounds like a good feature to have when using a more fully-featured DNS lookup library. Might want to open a new issue for that 😄