Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_asyncio: test_drain_raises() fails randomly on Windows #81051

Closed
vstinner opened this issue May 10, 2019 · 10 comments
Closed

test_asyncio: test_drain_raises() fails randomly on Windows #81051

vstinner opened this issue May 10, 2019 · 10 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir topic-asyncio

Comments

@vstinner
Copy link
Member

BPO 36870
Nosy @terryjreedy, @vstinner, @asvetlov, @1st1, @pablogsal

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2019-06-04.12:59:47.026>
created_at = <Date 2019-05-10.00:57:51.498>
labels = ['3.8', '3.7', 'tests', 'expert-asyncio']
title = 'test_asyncio: test_drain_raises() fails randomly on Windows'
updated_at = <Date 2019-06-04.12:59:47.026>
user = 'https://github.com/vstinner'

bugs.python.org fields:

activity = <Date 2019-06-04.12:59:47.026>
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date = <Date 2019-06-04.12:59:47.026>
closer = 'vstinner'
components = ['Tests', 'asyncio']
creation = <Date 2019-05-10.00:57:51.498>
creator = 'vstinner'
dependencies = []
files = []
hgrepos = []
issue_num = 36870
keywords = []
message_count = 10.0
messages = ['342023', '342357', '342462', '342467', '342472', '342476', '342509', '342510', '342517', '342522']
nosy_count = 5.0
nosy_names = ['terry.reedy', 'vstinner', 'asvetlov', 'yselivanov', 'pablogsal']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue36870'
versions = ['Python 3.7', 'Python 3.8']

@vstinner
Copy link
Member Author

https://ci.appveyor.com/project/python/cpython/builds/24376676

ERROR: test_drain_raises (test.test_asyncio.test_streams.StreamTests)
----------------------------------------------------------------------

Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_asyncio\test_streams.py", line 820, in test_drain_raises
    self.loop.run_until_complete(client(*addr))
  File "C:\projects\cpython\lib\asyncio\base_events.py", line 584, in run_until_complete
    return future.result()
  File "C:\projects\cpython\lib\test\test_asyncio\test_streams.py", line 810, in client
    await writer.drain()
  File "C:\projects\cpython\lib\asyncio\streams.py", line 351, in drain
    await fut
  File "C:\projects\cpython\lib\asyncio\selector_events.py", line 860, in write
    n = self._sock.send(data)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

@vstinner vstinner added 3.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir labels May 10, 2019
@terryjreedy
Copy link
Member

I have gotten this too, multiple times, on both Azure Pipelines and Appveyor. The latter is worse since required. There was also a Mac failure for Azure, not sure is same issue.

Please disable this test. External resource problems should not be blocking merges of good patches. This is especially obnoxious for backports because it is not possible to rerun by close and reopen, as closing causes the backport branch to be deleted.

@vstinner
Copy link
Member Author

Maybe the test started to fail randomly after this change:

commit 1cc0ee7
Author: Andrew Svetlov <andrew.svetlov@gmail.com>
Date: Tue May 7 16:53:19 2019 -0400

bpo-36801: Fix waiting in StreamWriter.drain for closing
SSL transport (GH-13098)

The test is quite old, added in bpo-25441:

commit c44ecdf
Author: Guido van Rossum <guido@python.org>
Date: Mon Oct 19 11:49:30 2015 -0700

Issue bpo-25441: asyncio: Raise error from drain() when socket is closed.

@vstinner
Copy link
Member Author

Another candidate:

commit a076e4f (refs/bisect/bad)
Author: Andrew Svetlov <andrew.svetlov@gmail.com>
Date: Thu May 9 15:14:58 2019 -0400

bpo-36802: Drop awrite()/aclose(), support await write() and await close() instead (bpo-13099)

Before this commit, the test pass. After this commit, the test still pass but logs a warning:

vstinner@WIN C:\vstinner\python\master>python -m test test_asyncio -m test_drain_raises -v
(...)
test_drain_raises (test.test_asyncio.test_streams.StreamTests) ... Task exception was never retrieved
future: <Task finished name='Task-2' coro=<StreamWriter.drain() done, defined at C:\vstinner\python\master\lib\asyncio\streams.py:417> exception=ConnectionAbor
tedError(10053, 'An established connection was aborted by the software in your host machine', None, 10053, None)>
Traceback (most recent call last):
  File "C:\vstinner\python\master\lib\asyncio\streams.py", line 434, in drain
    await fut
  File "C:\vstinner\python\master\lib\asyncio\proactor_events.py", line 370, in _loop_writing
    self._write_fut = self._loop._proactor.send(self._sock, data)
  File "C:\vstinner\python\master\lib\asyncio\windows_events.py", line 488, in send
    ov.WSASend(conn.fileno(), buf, flags)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
ok
(...)
Tests result: SUCCESS

@vstinner
Copy link
Member Author

I wrote PR 13316 to revert the commit a076e4f of bpo-36802:
https://bugs.python.org/issue36802#msg342471

@asvetlov
Copy link
Contributor

Please postpone the reversion for a while.
I think bpo-36916 fixes a message about the never retrieved exception.

@vstinner
Copy link
Member Author

PR 13313 has been merged into master. Let's see if it does fix this issue in master.

Python 3.7 is different: streams.py doesn't have _fast_drain() which was added by commit a076e4f (bpo-36802). So instead, I created PR 13328 to revert the commit 93aa57a of bpo-36801, to get more time to find a proper fix to Python 3.7.

@asvetlov
Copy link
Contributor

Agree with your conclusion

@vstinner
Copy link
Member Author

"""
commit 1cc0ee7
Author: Andrew Svetlov <andrew.svetlov@gmail.com>
Date: Tue May 7 16:53:19 2019 -0400

bpo-36801: Fix waiting in StreamWriter.drain for closing
SSL transport (GH-13098)

"""

I reverted this change in 3.7:

commit c647ad9 (HEAD -> 3.7, upstream/3.7)
Author: Victor Stinner <victor.stinner@gmail.com>
Date: Tue May 14 22:29:54 2019 +0200

Revert "bpo-36801: Fix waiting in StreamWriter.drain for closing SSL transport (GH-13098)" (GH-13328)

This reverts commit 93aa57ac6594d1cc30d147720fc8a7a4e1ca2d3e.

Without this revert, I was able to easily reproduce the failure. With the revert, I cannot reproduce it anymore:
#13328 (comment)

@vstinner
Copy link
Member Author

Andrew merged #13330 into master, it should fix this issue.

@vstinner vstinner closed this as completed Jun 4, 2019
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir topic-asyncio
Projects
None yet
Development

No branches or pull requests

4 participants