~andir/nixpkgs-dev

ml-tools: bug: dns timeouts v1 PROPOSED

William Casarin: 1
 bug: dns timeouts

 1 files changed, 43 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~andir/nixpkgs-dev/patches/22145/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH ml-tools] bug: dns timeouts Export this patch

---

Hey team,

Not sure if anyone else ran into this issue yet, but I've noticed b4
sometimes fails with a dns timeout when running `notmuch-am`. It looks
like it has something to do with dkim verification?

I've recorded this bug in the repo until anyone can figure out a good
workaround.

Cheers,
Will

 todo/dns-timeout | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 todo/dns-timeout

diff --git a/todo/dns-timeout b/todo/dns-timeout
new file mode 100644
index 0000000..8899454
--- /dev/null
+++ b/todo/dns-timeout
@@ -0,0 +1,43 @@
n: DNS Timeout
d: b4 sometimes fails with a DNS timeout, need to figure out why this happens, and if there's a way to bypass dkim domain checks.
t: bug,dkim
i: 1618841594.518946778-jb55@jb55.com

backtrace:

Analyzing 2 messages in the thread
---
Writing ./v3_20210416_ben_nixos_gmnisrv_init.mbx
Traceback (most recent call last):
  File "/nix/store/y5vqbq3x551chz3dj9i0zjzm7sxg5vnb-b4-0.6.2/bin/.b4-wrapped", line 9, in <module>
    sys.exit(cmd())
  File "/nix/store/y5vqbq3x551chz3dj9i0zjzm7sxg5vnb-b4-0.6.2/lib/python3.8/site-packages/b4/command.py", line 213, in cmd
    cmdargs.func(cmdargs)
  File "/nix/store/y5vqbq3x551chz3dj9i0zjzm7sxg5vnb-b4-0.6.2/lib/python3.8/site-packages/b4/command.py", line 40, in cmd_am
    b4.mbox.main(cmdargs)
  File "/nix/store/y5vqbq3x551chz3dj9i0zjzm7sxg5vnb-b4-0.6.2/lib/python3.8/site-packages/b4/mbox.py", line 538, in main
    mbox_to_am(threadfile, cmdargs)
  File "/nix/store/y5vqbq3x551chz3dj9i0zjzm7sxg5vnb-b4-0.6.2/lib/python3.8/site-packages/b4/mbox.py", line 114, in mbox_to_am
    am_mbx = lser.save_am_mbox(mbx, noaddtrailers=cmdargs.noaddtrailers,
  File "/nix/store/y5vqbq3x551chz3dj9i0zjzm7sxg5vnb-b4-0.6.2/lib/python3.8/site-packages/b4/__init__.py", line 535, in save_am_mbox
    if latt and latt.validate(lmsg.msg):
  File "/nix/store/y5vqbq3x551chz3dj9i0zjzm7sxg5vnb-b4-0.6.2/lib/python3.8/site-packages/b4/__init__.py", line 1915, in validate
    self.lsig = LoreAttestationSignatureDKIM(msg)
  File "/nix/store/y5vqbq3x551chz3dj9i0zjzm7sxg5vnb-b4-0.6.2/lib/python3.8/site-packages/b4/__init__.py", line 1707, in __init__
    res = dkim.verify(self.msg.as_bytes(), dnsfunc=dkim_get_txt)
  File "/nix/store/y995b8xjx986sz3v9643myd9q0myf4gj-python3.8-dkimpy-1.0.5/lib/python3.8/site-packages/dkim/__init__.py", line 1352, in verify
    return d.verify(dnsfunc=dnsfunc)
  File "/nix/store/y995b8xjx986sz3v9643myd9q0myf4gj-python3.8-dkimpy-1.0.5/lib/python3.8/site-packages/dkim/__init__.py", line 940, in verify
    return self.verify_sig(sig, include_headers, sigheaders[idx], dnsfunc)
  File "/nix/store/y995b8xjx986sz3v9643myd9q0myf4gj-python3.8-dkimpy-1.0.5/lib/python3.8/site-packages/dkim/__init__.py", line 773, in verify_sig
    self.pk, self.keysize, self.ktag, self.seqtlsrpt = load_pk_from_dns(name,
  File "/nix/store/y995b8xjx986sz3v9643myd9q0myf4gj-python3.8-dkimpy-1.0.5/lib/python3.8/site-packages/dkim/__init__.py", line 481, in load_pk_from_dns
    s = dnsfunc(name, timeout=timeout)
  File "/nix/store/y5vqbq3x551chz3dj9i0zjzm7sxg5vnb-b4-0.6.2/lib/python3.8/site-packages/b4/__init__.py", line 2452, in dkim_get_txt
    a = _resolver.resolve(lookup, dns.rdatatype.TXT, raise_on_no_answer=False, lifetime=timeout, search=True)
  File "/nix/store/ih0gs9ynv83jjsiq6h32dh28fd1ykxp0-python3.8-dnspython-2.0.0/lib/python3.8/site-packages/dns/resolver.py", line 1043, in resolve
    timeout = self._compute_timeout(start, lifetime)
  File "/nix/store/ih0gs9ynv83jjsiq6h32dh28fd1ykxp0-python3.8-dnspython-2.0.0/lib/python3.8/site-packages/dns/resolver.py", line 950, in _compute_timeout
    raise Timeout(timeout=duration)
dns.exception.Timeout: The DNS operation timed out after 5.4021406173706055 seconds
 
-- 
2.30.0
> I've noticed b4 sometimes fails with a dns timeout when running `notmuch-am`.
Why would it hit internet in the first place? In our environment it does not
have to, does it?