Fix the panic when a query response comes after the read() timesout #1088
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the cached udp connection to an external nameserver the following can happen..
DEBU[0064] Query name.[1] from 127.0.0.11:42291, forwarding to udp:8.8.8.8
DEBU[0067] Read from DNS server failed, read udp 172.20.0.2:47916->8.8.8.8:53: i/o timeout
now the saved context for the forwarded query will be cleared
DEBU[0069] Query name.[1] from 127.0.0.11:42291, forwarding to udp:8.8.8.8
Since the first query timed out client resolver retries; when the DNS server is waiting for the response it could receive the reply for the previous query whose context has been cleaned up already.
DEBU[0069] Can't retrieve client context for dns id 6063
Added a missing nil check for this case and increased the read timeout (typical client resolver timeout is 5 seconds; hence keeping the read timeout to 4 seconds)
Fixes #1087
Signed-off-by: Santhosh Manohar santhosh@docker.com