title: python3/windows-10 UDP socket bug?
body: <p>Not sure what I've got here, but something with python UDP sockets seems strangely busted.  I've isolated a unittest that was failing into it's own simplified code and included it below. It intermittently fails (about 1 time out of 10 runs). I can find no pattern to the failure. Sometimes it will fail the first time, and then succeed the next 9. Another time it will pass the first 5 times, fail once, and then resume succeeding.</p>
  
  <p>The test machine is Windows 10-Pro running python 3.8.1</p>
  
  <p>When it fails, the packet is never sent. I can confirm this running WireShark and tracing UDP packets on the loopback interface. When it fails, the packet is not sent.  I understand UDP is non-guaranteed <strong>delivery</strong>, but  I never considered this could be extended to non-guaranteed transmission. Is it possible I'm witnessing some sort of Windows UDP packet drop scenario?</p>
  
  <p>Note: The code below is a contrived test to demonstrate the issue, but it's the minimal working example (MWE).</p>
  
  <pre><code>import socket, threading, unittest
  
  class Testmysock(unittest.TestCase):
      r"""mysock unittest test case"""
  
      def test_hello(self):
          r"""test hello over udp"""
  
          def hello():
              r"""reply to server with hello"""
              with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
                  sock.sendto(b'hello', ('127.0.0.1', 55000))
  
          with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
              sock.bind(('127.0.0.1', 55000))
              thr = threading.Thread(target=hello)
              thr.start()
              sock.settimeout(2.0)
              msg = sock.recv(128)
              self.assertEqual(b'hello', msg)
              thr.join(0.0)
  </code></pre>
  
  <p>When it fails, it reports <code>socket.timeout</code>, which is due to the call to <code>settimeout</code>. I've experimented setting the timeout as high as 30-seconds, but it does not change the failure, nor does it alter the failure frequency.</p>
  
  <p>I have confirmed there is nothing bound on UDP port 55000, and all firewalls are disabled on the test machine.</p>
  
  <p>Any thoughts or ideas (no matter how crazy) would be appreciated.</p>