TCP dispatch timeout can cause shutdown hang
When a TCP dispatch times out, tcp_recv()
cancels the oldest active query. If there are still other active queries waiting, then it resumes reading, but it doesn't reset the timer, so the subsequent queries can never time out. If the server shuts down while they're still pending then it can hang due to an un-detached network handle.
This can be observed in main
by adding sleep 15
immediately after calling wait
:
echo_i "waiting for nsupdate to finish ($n)"
wait
n=`expr $n + 1`
echo_i "sleeping 15 seconds"
sleep 15