Skip to content

TCP DNS cannot be used on WSL #3046

@gezero

Description

@gezero

Description

As an WSL user, I want to use DSNResolving so that I can get besu peers faster.

Acceptance Criteria

  • when starting besu from WSL I want the DNSResolver feature to work.

Steps to Reproduce (Bug)

  1. run besu on WSL

Expected behavior: [What you expect to happen]
Peers get quickly found because the DNSResolver helps finding those

Actual behavior: [What actually happens]
The DNSResolver throws an exception and does not find any peers

2021-11-11 11:49:29.139+00:00 | Timer-0 | WARN  | DNSResolver | I/O exception contacting remote DNS server /172.20.64.1:53
java.net.SocketTimeoutException
        at org.xbill.DNS.Resolver.send(Resolver.java:159)
        at org.apache.tuweni.discovery.DNSResolver.resolveRecordRaw(DNSResolver.kt:150)
        at org.apache.tuweni.discovery.DNSResolver.resolveRecord(DNSResolver.kt:73)
        at org.apache.tuweni.discovery.DNSResolver.visitTree(DNSResolver.kt:115)
        at org.apache.tuweni.discovery.DNSResolver.visitTree(DNSResolver.kt:106)
        at org.apache.tuweni.discovery.DNSResolver.collectAll(DNSResolver.kt:95)
        at org.apache.tuweni.discovery.DNSTimerTask.run(DNSDaemon.kt:79)
        at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
        at java.base/java.util.TimerThread.run(Timer.java:506)

Frequency: [What percentage of the time does it occur?]
Always broken on my machine. I had to manually switch to a different DNS to workaround the issue.

Versions (Add all that apply)

  • Java version: [openjdk version "11.0.11" 2021-04-20]
  • OS Name & Version: [Ubuntu 20.04 LTS as WSL on Windows 10]

Additional Information

When looking at the code it seems that the underlying implementation is using TCP to communicate with the DNS. TCP is not allowed in WSL by default it seems like. consider the following:

dig @172.20.64.1 google.com

; <<>> DiG 9.16.1-Ubuntu <<>> @172.20.64.1 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12665
;; flags: qr rd ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;google.com.                    IN      A

;; ANSWER SECTION:
google.com.             0       IN      A       142.250.200.46

;; Query time: 0 msec
;; SERVER: 172.20.64.1#53(172.20.64.1)
;; WHEN: Thu Nov 11 17:41:37 GMT 2021
;; MSG SIZE  rcvd: 54

but

dig +tcp @172.20.64.1 google.com
;; Connection to 172.20.64.1#53(172.20.64.1) for google.com failed: timed out.
;; Connection to 172.20.64.1#53(172.20.64.1) for google.com failed: timed out.

; <<>> DiG 9.16.1-Ubuntu <<>> +tcp @172.20.64.1 google.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

;; Connection to 172.20.64.1#53(172.20.64.1) for google.com failed: timed out.

On the other hand:

dig +tcp @8.8.8.8 google.com

; <<>> DiG 9.16.1-Ubuntu <<>> +tcp @8.8.8.8 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21209
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;google.com.                    IN      A

;; ANSWER SECTION:
google.com.             36      IN      A       216.58.212.206

;; Query time: 10 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Nov 11 17:42:50 GMT 2021
;; MSG SIZE  rcvd: 55

Metadata

Metadata

Assignees

Labels

P4Low (ex: Node doesn't start up when the configuration file has unexpected "end-of-line" character)bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions