commit | 3c07ec67d152e200ad708e12db97800430378572 | [log] [tgz] |
---|---|---|
author | Mike Yu <yumike@google.com> | Wed Jul 01 12:02:14 2020 +0800 |
committer | Mike Yu <yumike@google.com> | Thu Jul 02 14:04:23 2020 +0800 |
tree | f10678933ef32ccaeb08734a89d0164d63d0c927 | |
parent | c35b4541c3c7e7e7bd339a036ebe1ad9e94a10eb [diff] |
Fix private DNS not working due to getConnectCounter() stuck This call is not necessary to be protected by DnsTlsDispatcher::sLock. The lock aims at protecting the creation/deletion of DnsTlsTransport. Since the call is used only for the metrics, this change doesn't impact on the functionality of private DNS. Bug description: When a thread gets stuck in TLS handshake, it might lead to another thread blocking in the call getConnectCounter(). This results in other DNS requests get stuck in the call getOrderedServerList() because they are awaiting a lock hold by the second thread which is also awaiting another lock hold by the first thread. An example scenario is: In DNS strict mode, a private DNS server used to be available in mobile data but becomes unresponsive. Then, a new DNS request triggers the DnsResolver to do handshaking. Before the handshake finishes, wifi can't work. How to reproduce the bug: 1) Set DNS strict mode, turn on mobile data 2) Wait 20s for TLS connection disconnected. It can be check by: - ps -AT $(pidof netd) | grep "TlsListen" 3) Drop DoT traffic by the command: - iptables -A OUTPUT -p tcp --dport 853 -o rmnet_data1 -j DROP 4) Turn on wifi. Wifi shows no internet Bug: 160027328 Test: not reproducible by the above steps Test: cd packages/modules/DnsResolver && atest Change-Id: I050ce8f13c19f706d58bac44c0e5a269481cb0c0
This code uses LOG(X) for logging. Log levels are VERBOSE,DEBUG,INFO,WARNING and ERROR. The default setting is WARNING and logs relate to WARNING and ERROR will be shown. If you want to enable the DEBUG level logs, using following command. adb shell service call dnsresolver 10 i32 1 VERBOSE 0 DEBUG 1 INFO 2 WARNING 3 ERROR 4 Verbose resolver logs could contain PII -- do NOT enable in production builds.