Skip to content

gh-90978: asyncio TestSSL uses SHORT_TIMEOUT#92642

Merged
vstinner merged 1 commit intopython:mainfrom
vstinner:asyncio_test_ssl_timeout
May 11, 2022
Merged

gh-90978: asyncio TestSSL uses SHORT_TIMEOUT#92642
vstinner merged 1 commit intopython:mainfrom
vstinner:asyncio_test_ssl_timeout

Conversation

@vstinner
Copy link
Member

TestSSL of asyncio now uses support.SHORT_TIMEOUT rather than
hardcoded timeouts like 5, 10 or 40 seconds.

TestSSL of asyncio now uses support.SHORT_TIMEOUT rather than
hardcoded timeouts like 5, 10 or 40 seconds.
@vstinner vstinner requested review from 1st1 and asvetlov as code owners May 10, 2022 21:23
@bedevere-bot bedevere-bot added tests Tests in the Lib/test dir awaiting core review labels May 10, 2022
@vstinner
Copy link
Member Author

Follow-up of PR #92402. See issue gh-90978.

Example of recent failure on x86 Gentoo Installed with X 3.x:

ERROR: test_create_server_ssl_over_ssl (test.test_asyncio.test_ssl.TestSSL.test_create_server_ssl_over_ssl)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.12/test/test_asyncio/test_ssl.py", line 1090, in do
    rv = func(*args)
         ^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.12/ssl.py", line 921, in read
    v = self._sslobj.read(len)
        ^^^^^^^^^^^^^^^^^^^^^^
ssl.SSLWantReadError: The operation did not complete (read) (_ssl.c:2546)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.12/test/test_asyncio/test_ssl.py", line 1157, in test_create_server_ssl_over_ssl
    self.loop.run_until_complete(start_server())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.12/asyncio/base_events.py", line 650, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.12/test/test_asyncio/test_ssl.py", line 1150, in start_server
    await asyncio.wait_for(asyncio.gather(*tasks), TIMEOUT)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.12/asyncio/tasks.py", line 488, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.12/test/test_asyncio/test_ssl.py", line 1128, in test_client
    await fut
    ^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.12/test/test_asyncio/test_ssl.py", line 1103, in prog
    data = do(sslobj.read, 2)
           ^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.12/test/test_asyncio/test_ssl.py", line 1095, in do
    incoming.write(sock.recv(65536))
                   ^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.12/ssl.py", line 1263, in recv
    return self.read(buflen)
           ^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/cpython/3.x.ware-gentoo-x86.installed/build/target/lib/python3.12/ssl.py", line 1136, in read
    return self._sslobj.read(len)
           ^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out

https://buildbot.python.org/all/#/builders/464/builds/2336

@vstinner
Copy link
Member Author

@asvetlov @pablogsal: More changes to avoid hardcoded timeouts.

@vstinner vstinner merged commit 1d1929f into python:main May 11, 2022
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@vstinner vstinner deleted the asyncio_test_ssl_timeout branch May 11, 2022 21:25
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 11, 2022
TestSSL of asyncio now uses support.SHORT_TIMEOUT rather than
hardcoded timeouts like 5, 10 or 40 seconds.
(cherry picked from commit 1d1929f)

Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label May 11, 2022
@bedevere-bot
Copy link

GH-92690 is a backport of this pull request to the 3.11 branch.

miss-islington added a commit that referenced this pull request May 11, 2022
TestSSL of asyncio now uses support.SHORT_TIMEOUT rather than
hardcoded timeouts like 5, 10 or 40 seconds.
(cherry picked from commit 1d1929f)

Co-authored-by: Victor Stinner <vstinner@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants