Subject: | Persistent UDP reports false timeouts. |
Scenario. This is time dependent so I cannot provide code that will allow to reproduce it with 100% reliability:
my $resolver = Net::DNS::Resolver->new(
'udp_timeout' => 2,
'persistent_udp' => 1,
'retrans' => 1,
'retry' => 1
);
$resolver->search( 'a.com', 'MX' ); # domain that triggers timeout
$resolver->search( 'b.com', 'MX' ); # valid domain but gets error "FAIL query timed out"
From my code understanding:
1. request is sent to NS about a.com
2. timeout is triggered
3. request is sent to NS about b.com
4. NS socket is added to select
5. NS socket has answer (from domain a.com!!)
6. NS socket is removed from select
7. response gets parsed by _decode_reply()
8. it gets rejected because header IDs does not match
9 control goes back to can_read(), but socket was removed from select in 6
10. socket read loop exits, no sockets to read from
11. domain b.com gets "query timed out" false error
12. true b.com answer is not read from socket and may cause exactly the same issue with next query
Fix: Maybe failed header ID (in 8) should put socket back to select monitoring pool when persistent UDP is enabled?