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
Loading