Possible race in dns_dispatch_connect()
A test failure turned up in !6562 (merged) that indicates a probable race in dns_dispatch_connect()
: thread 1 sets disp->tcpstate
from NONE to CONNECTING; thread 2 finds disp->tcpstate
is CONNECTING, locks the dispatch, appends something to disp->pending
, and unlocks; thread 1 locks the dispatch, finds that disp->pending
is not empty, and asserts.
I think the correct fix is just to remove the INSIST
that the list has to be empty.