This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_asyncore.TestAPI_UseIPv4Select / test_asyncore.TestAPI_UseIPv6Select fails test_handle_close_after_conn_broken
Type: Stage: resolved
Components: Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder: Close asyncore/asynchat/smtpd issues and list them here
View: 45552
Assigned To: Nosy List: patrila
Priority: normal Keywords: patch

Created on 2017-01-04 12:22 by patrila, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-3.6.3-Fix_test_asyncore_test_handle_close_after_conn_broken.patch patrila, 2017-12-02 10:21
Messages (3)
msg284633 - (view) Author: (patrila) Date: 2017-01-04 12:22
Dear Python developers

python-2.7.12, python-3.4.5 and the current "default" branch fail the tests

* test.test_asyncore.TestAPI_UseIPv4Select.test_handle_close_after_conn_broken
* test.test_asyncore.TestAPI_UseIPv6Select.test_handle_close_after_conn_broken

(difference is only if IPv4 or IPv6 is used). The output of the test-suite is

$ ./python -m unittest test.test_asyncore.TestAPI_UseIPv4Select.test_handle_close_after_conn_broken test.test_asyncore.TestAPI_UseIPv6Select.test_handle_close_after_conn_broken
FF
======================================================================
FAIL: test_handle_close_after_conn_broken (test.test_asyncore.TestAPI_UseIPv4Select)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ".../Lib/test/test_asyncore.py", line 648, in test_handle_close_after_conn_broken
    self.loop_waiting_for_flag(client)
  File ".../Lib/test/test_asyncore.py", line 511, in loop_waiting_for_flag
    self.fail("flag not set")
AssertionError: flag not set

======================================================================
FAIL: test_handle_close_after_conn_broken (test.test_asyncore.TestAPI_UseIPv6Select)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ".../Lib/test/test_asyncore.py", line 648, in test_handle_close_after_conn_broken
    self.loop_waiting_for_flag(client)
  File ".../Lib/test/test_asyncore.py", line 511, in loop_waiting_for_flag
    self.fail("flag not set")
AssertionError: flag not set

----------------------------------------------------------------------
Ran 2 tests in 10.000s

FAILED (failures=2)


However, I also encounter sometimes a success (for both IPv6 and also IPv4). Therefore, I re-run the tests 100 times, this was the result:

success rate of IPv4 test: 2/100
success rate of IPv6 test: 4/100

I conjecture that there is some kind of race condition behind the scenes which sometimes is "won" but more often lost.

I'm running this test on Linux 4.8. I also did find nothing in the system logs related to the issue.
msg307423 - (view) Author: (patrila) Date: 2017-12-02 10:21
Adding a 'time.sleep(0.01)' before the 'send()' statement in test.test_asyncore.BaseTestAPI.test_handle_close_after_conn_broken.TestClient.handle_write works around this problem. Unsure if this a fix or just a workaround.

Patch attached.
msg317735 - (view) Author: (patrila) Date: 2018-05-26 10:23
May I ask what's preventing this issue from being resolved?
History
Date User Action Args
2022-04-11 14:58:41adminsetgithub: 73337
2021-10-21 11:25:12iritkatrielsetstatus: open -> closed
superseder: Close asyncore/asynchat/smtpd issues and list them here
resolution: wont fix
stage: resolved
2018-05-26 10:23:24patrilasetmessages: + msg317735
versions: + Python 3.8
2017-12-02 10:21:38patrilasetfiles: + python-3.6.3-Fix_test_asyncore_test_handle_close_after_conn_broken.patch
keywords: + patch
messages: + msg307423
2017-01-04 12:22:05patrilacreate