DoH/UDP DNS context deadline exceeded
Describe the bug
app/dns: failed to retrieve response > Post "https://1.1.1.1/dns-query": context deadline exceeded
To Reproduce
- Use DoH as the remote/direct DNS (e.g.
https://1.1.1.1/dns-query,https+local://223.5.5.5/dns-query) - Interupt the connection (e.g. by switching network environment) when there are active DNS queries
- DNS queries always fail and report
app/dns: failed to retrieve response > Post "https://1.1.1.1/dns-query": context deadline exceeded
Additional context
I can reproduce the same error on v2rayNG (Xray-core), so this is not a bug introduced here.
Removing DoH keepalive won't help.
Although only http.Transport is different, DoH3 (e.g. h3://1.1.1.1/dns-query) does not have this issue and can automatically recover from context deadline exceeded.
When using quic-go http3 v0.43.0-v0.45.0, DoH3 does have this issue but this was later fixed in quic-go v0.45.1. For unknown reason, the same thing happens on DoH (which uses net/http).
Update: Maybe 0.11.3/0.12.0-beta04 fixed (more preciously, workarounded) this.
Since unknown time, this has been happening for DNS over H3.
Done in 0.15.5. (Just a workaround not a fix?)