New submission from Steve Dower:

The test at Lib/test/test_socket.py:3883 is failing intermittently (but more 
often than not) due to a race condition between the two threads involved in the 
test.

======================================================================
FAIL: testRecv (test.test_socket.NonBlockingTCPTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\build\cpython\lib\test\test_socket.py", line 3883, in testRecv
    self.fail("Error trying to do non-blocking recv.")
AssertionError: Error trying to do non-blocking recv.

----------------------------------------------------------------------

The message in this case means the recv succeeded when it should have failed 
due to lack of data. But the second thread just delays briefly before sending 
data, and apparently the main thread can stall long enough for the data to be 
available in the first part of the test.

A quick check using an Event rather than the sleep shows that the race 
condition can be fixed, but it seems like this may affect more tests as a lot 
seem to involve sleep-based timing.

(I've only seen this on Windows, but I see no reason why it shouldn't affect 
other platforms as well.)

----------
components: Tests
messages: 238121
nosy: pitrou, steve.dower
priority: normal
severity: normal
status: open
title: test_socket.NonBlockingTCPTests failing due to race condition
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23669>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to