Issue44011
Created on 2021-05-02 20:33 by asvetlov, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 17975 | merged | asvetlov, 2021-05-02 20:34 | |
| PR 25840 | merged | christian.heimes, 2021-05-03 06:37 | |
| PR 25842 | merged | asvetlov, 2021-05-03 08:26 | |
| PR 25846 | closed | asvetlov, 2021-05-03 10:14 | |
| PR 25848 | merged | pablogsal, 2021-05-03 12:54 | |
| PR 31275 | merged | kumaraditya, 2022-02-11 12:20 | |
| PR 31597 | merged | kumaraditya, 2022-02-26 07:46 | |
| Messages (18) | |||
|---|---|---|---|
| msg392726 - (view) | Author: Andrew Svetlov (asvetlov) * ![]() |
Date: 2021-05-02 20:33 | |
There is a PR created a long time ago. Finally, I've ported tests for it also. The documentation doesn't mention new ssh_shutdown_timeout parameter yet. The latest changes from https://github.com/MagicStack/uvloop/pull/385 can be applied separately. |
|||
| msg392739 - (view) | Author: Andrew Svetlov (asvetlov) * ![]() |
Date: 2021-05-02 21:34 | |
New changeset 5fb06edbbb769561e245d0fe13002bab50e2ae60 by Andrew Svetlov in branch 'master': bpo-44011: New asyncio ssl implementation (#17975) https://github.com/python/cpython/commit/5fb06edbbb769561e245d0fe13002bab50e2ae60 |
|||
| msg392769 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2021-05-03 06:32 | |
The commit has broken multiple build bots, e.g .https://buildbot.python.org/all/#/builders/345/builds/134/steps/5/logs/stdio The new code is missing checks for presence of ssl module. It's an optional component. |
|||
| msg392771 - (view) | Author: Karthikeyan Singaravelan (xtreak) * ![]() |
Date: 2021-05-03 07:16 | |
The PR made sslproto a hard dependency that even import asyncio fails on non-ssl builds and thus anything that indirectly import asyncio also fails. It seems some of the test modules can be skipped. Some parts of the asyncio codebase already has checks for ssl and has to be done for new parts. Attached is a patch to add more checks but it will be helpful to ensure only relevant parts that absolutely require ssl are skipped. The test_make_socket_transport is slightly tricky since it tries to simulate ssl being not present by patching it but mock does import of sslproto which will fail since SSLAgainErrors is initialized at module level. Perhaps the test can be modified better to only mock if ssl is not present. diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index e54ee309e4..6ccac76dfb 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -41,13 +41,14 @@ from . import exceptions from . import futures from . import protocols -from . import sslproto from . import staggered from . import tasks from . import transports from . import trsock from .log import logger +if ssl is not None: + from . import sslproto __all__ = 'BaseEventLoop', diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index 10852afe2b..ac0dc1978c 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -19,11 +19,17 @@ from . import futures from . import exceptions from . import protocols -from . import sslproto from . import transports from . import trsock from .log import logger +try: + import ssl +except ImportError: # pragma: no cover + ssl = None + +if ssl is not None: + from . import sslproto def _set_socket_extra(transport, sock): transport._extra['socket'] = trsock.TransportSocket(sock) @@ -826,6 +832,9 @@ def loop(f=None): server, addr, conn) protocol = protocol_factory() if sslcontext is not None: + if ssl is None: + raise RuntimeError('Python ssl module is not available') + self._make_ssl_transport( conn, protocol, sslcontext, server_side=True, extra={'peername': addr}, server=server, diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index 63ab15f30f..9bc9a03699 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -23,11 +23,12 @@ from . import events from . import futures from . import protocols -from . import sslproto from . import transports from . import trsock from .log import logger +if ssl is not None: + from . import sslproto def _test_selector_event(selector, fd, event): # Test if the selector is monitoring 'event' events @@ -213,6 +214,9 @@ def _accept_connection( protocol = protocol_factory() waiter = self.create_future() if sslcontext: + if ssl is None: + raise RuntimeError('Python ssl module is not available') + transport = self._make_ssl_transport( conn, protocol, sslcontext, waiter=waiter, server_side=True, extra=extra, server=server, diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py index 349e4f2dca..6aaa7a86be 100644 --- a/Lib/test/test_asyncio/test_selector_events.py +++ b/Lib/test/test_asyncio/test_selector_events.py @@ -70,6 +70,7 @@ def test_make_socket_transport(self): close_transport(transport) + @unittest.skipIf(ssl is None, 'No ssl module') @mock.patch('asyncio.selector_events.ssl', None) @mock.patch('asyncio.sslproto.ssl', None) def test_make_ssl_transport_without_ssl_error(self): diff --git a/Lib/test/test_asyncio/test_ssl.py b/Lib/test/test_asyncio/test_ssl.py index 38235c63e0..c58346bcab 100644 --- a/Lib/test/test_asyncio/test_ssl.py +++ b/Lib/test/test_asyncio/test_ssl.py @@ -1,3 +1,8 @@ +from test.support import import_helper + +# Skip tests if we don't have ssl +import_helper.import_module('ssl') + import asyncio import asyncio.sslproto import contextlib diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py index 79a81bd8c3..2edbb11b58 100644 --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -11,6 +11,9 @@ except ImportError: ssl = None +# Skip tests if we don't have ssl +support.import_helper.import_module('ssl') + import asyncio from asyncio import log from asyncio import protocols |
|||
| msg392774 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2021-05-03 07:32 | |
PR GH-25840 fixes most issues. Gentoo with X buildbot https://buildbot.python.org/all/#builders/465/builds/23 has one failing test. ====================================================================== ERROR: test_create_server_ssl_over_ssl (test.test_asyncio.test_ssl.TestSSL) ---------------------------------------------------------------------- asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/buildbot/buildarea/cpython/pull_request.ware-gentoo-x86.installed/build/target/lib/python3.10/asyncio/tasks.py", line 458, in wait_for fut.result() asyncio.exceptions.CancelledError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/buildbot/buildarea/cpython/pull_request.ware-gentoo-x86.installed/build/target/lib/python3.10/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/pull_request.ware-gentoo-x86.installed/build/target/lib/python3.10/asyncio/base_events.py", line 644, in run_until_complete return future.result() File "/buildbot/buildarea/cpython/pull_request.ware-gentoo-x86.installed/build/target/lib/python3.10/test/test_asyncio/test_ssl.py", line 1150, in start_server await asyncio.wait_for(asyncio.gather(*tasks), TIMEOUT) File "/buildbot/buildarea/cpython/pull_request.ware-gentoo-x86.installed/build/target/lib/python3.10/asyncio/tasks.py", line 460, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError ---------------------------------------------------------------------- |
|||
| msg392775 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2021-05-03 07:39 | |
New changeset 37ebdf0a866457ce825d0ff6e498a10938895760 by Christian Heimes in branch 'master': bpo-44011: Fix asyncio tests without ssl module (GH-25840) https://github.com/python/cpython/commit/37ebdf0a866457ce825d0ff6e498a10938895760 |
|||
| msg392776 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2021-05-03 07:41 | |
I have merged my PR to unblock buildbots. Karthikeyan has made suggestions how to improve the tests even further. CI also had some issues with OpenSSL 3.0.0-alpha15. Please run the tests with new OpenSSL version, too. "make multissltest" automates download, compilation, local installation, and testing. |
|||
| msg392798 - (view) | Author: Pablo Galindo Salgado (pablogsal) * ![]() |
Date: 2021-05-03 12:34 | |
Since commit https://github.com/python/cpython/commit/5fb06edbbb769561e245d0fe13002bab50e2ae60 was merged there are multiple timeouts in several buildbots. Unfortunately if this is not fixed by the time I need to do the beta release I may need to revert all these commits until all buildbots are stable again. Could someone investigate those timeouts? For instance, check: https://buildbot.python.org/all/#/builders/464/builds/138 |
|||
| msg392799 - (view) | Author: Christian Heimes (christian.heimes) * ![]() |
Date: 2021-05-03 12:41 | |
When was https://buildbot.python.org/all/#/builders/464/builds/138 start? The build properties tab doesn't have a start timestamp. Andrew, increase timeout doesn't seem to help. It's looks like the test suite is leaking threads on error. |
|||
| msg392800 - (view) | Author: Pablo Galindo Salgado (pablogsal) * ![]() |
Date: 2021-05-03 12:56 | |
I have created https://github.com/python/cpython/pull/25848 for the revert, in case this is not fixed in the next hours or so. Given the nature of PR 17975, this should have tested with the buildbots as the release team asked in: https://mail.python.org/archives/list/python-committers@python.org/thread/SIJQE3BZ6ICCGNJWFR4YR65BQBJJZZAZ/ and https://mail.python.org/archives/list/python-committers@python.org/thread/V7V5JHKZCJVE2GTI5NFEP3PNKOLH35VL/ |
|||
| msg392802 - (view) | Author: Pablo Galindo Salgado (pablogsal) * ![]() |
Date: 2021-05-03 13:00 | |
Specifically this part of both messages: >> If your change involves some platform-specific behaviour or has a >> non-trivial amount of C code, make sure you run the buildbots >> in your Pull Request by using the "test-with-buildbots" label ( >> https://discuss.python.org/t/now-you-can-test-a-pr-with-the-buildbots-before...). >> Alternatively you could check the buildbots post-merge in the buildbot server: >> https://buildbot.python.org/all/#/builders?tags=%2B3.x&tags=%2Bstable >> This is very important because if problems are detected at the time >> of the >> release, the release management team may have to revert >> the changes and therefore those will not be included in Python 3.10. |
|||
| msg392813 - (view) | Author: Pablo Galindo Salgado (pablogsal) * ![]() |
Date: 2021-05-03 15:22 | |
New changeset 7719953b30430b351ba0f153c2b51b16cc68ee36 by Pablo Galindo in branch 'master': bpo-44011: Revert "New asyncio ssl implementation (GH-17975)" (GH-25848) https://github.com/python/cpython/commit/7719953b30430b351ba0f153c2b51b16cc68ee36 |
|||
| msg392815 - (view) | Author: Pablo Galindo Salgado (pablogsal) * ![]() |
Date: 2021-05-03 15:37 | |
Unfortunately I have reverted 5fb06edbbb769561e245d0fe13002bab50e2ae60 commit to unblock the beta release :( I know that nobody wants this but my responsibilities as a release manager is to safeguard the stability of the release and we are too close to the beta release to do all the testing we need, giving that many buildbots have been broken in a short timespan. Andrew, we can try to get your PR merge between beta 1 and beta 2 but once we have done extensive testing and we know that there will be no impact on the buildbots and the CI. Thank you all for your understanding |
|||
| msg413062 - (view) | Author: Kumar Aditya (kumaraditya) * ![]() |
Date: 2022-02-11 12:13 | |
Since it was reverted as it was beta period, Can this be committed again as 3.11 is in alpha currently? @asvetlov |
|||
| msg413065 - (view) | Author: Kumar Aditya (kumaraditya) * ![]() |
Date: 2022-02-11 12:23 | |
I created a draft PR by rebasing the old implementation of 3.10 for 3.11 so we can investigate the build-bots failure and fix them so this can be committed for 3.11. See https://github.com/python/cpython/pull/31275 |
|||
| msg413288 - (view) | Author: Andrew Svetlov (asvetlov) * ![]() |
Date: 2022-02-15 13:04 | |
New changeset 13c10bfb777483c7b02877aab029345a056b809c by Kumar Aditya in branch 'main': bpo-44011: New asyncio ssl implementation (#31275) https://github.com/python/cpython/commit/13c10bfb777483c7b02877aab029345a056b809c |
|||
| msg413289 - (view) | Author: Andrew Svetlov (asvetlov) * ![]() |
Date: 2022-02-15 13:05 | |
The code had landed. Need a follow-up PR with documentation update (mention new ssl_shutdown_timeout arguments) |
|||
| msg414102 - (view) | Author: Andrew Svetlov (asvetlov) * ![]() |
Date: 2022-02-26 13:06 | |
New changeset 41ddcd3f40f8171a396e57b841a74fcc83884eab by Kumar Aditya in branch 'main': bpo-44011: Document ssl_shutdown_timeout added by revisited asyncio SSL implementation (GH-31597) https://github.com/python/cpython/commit/41ddcd3f40f8171a396e57b841a74fcc83884eab |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:45 | admin | set | github: 88177 |
| 2022-02-26 13:06:50 | asvetlov | set | messages: + msg414102 |
| 2022-02-26 07:46:36 | kumaraditya | set | pull_requests: + pull_request29720 |
| 2022-02-22 21:12:45 | asvetlov | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2022-02-15 13:06:10 | asvetlov | set | priority: critical -> normal |
| 2022-02-15 13:05:59 | asvetlov | set | messages: + msg413289 |
| 2022-02-15 13:04:08 | asvetlov | set | messages: + msg413288 |
| 2022-02-11 13:08:16 | kumaraditya | set | versions: + Python 3.11, - Python 3.10 |
| 2022-02-11 12:38:08 | christian.heimes | set | nosy:
- christian.heimes |
| 2022-02-11 12:23:49 | kumaraditya | set | messages: + msg413065 |
| 2022-02-11 12:20:21 | kumaraditya | set | pull_requests: + pull_request29438 |
| 2022-02-11 12:13:56 | kumaraditya | set | nosy:
+ kumaraditya messages: + msg413062 |
| 2021-05-03 15:37:22 | pablogsal | set | messages: + msg392815 |
| 2021-05-03 15:22:02 | pablogsal | set | messages: + msg392813 |
| 2021-05-03 13:00:16 | pablogsal | set | messages: + msg392802 |
| 2021-05-03 12:56:11 | pablogsal | set | messages: + msg392800 |
| 2021-05-03 12:54:25 | pablogsal | set | pull_requests: + pull_request24531 |
| 2021-05-03 12:41:10 | christian.heimes | set | messages: + msg392799 |
| 2021-05-03 12:34:46 | pablogsal | set | messages: + msg392798 |
| 2021-05-03 10:14:01 | asvetlov | set | pull_requests: + pull_request24529 |
| 2021-05-03 08:26:22 | asvetlov | set | pull_requests: + pull_request24526 |
| 2021-05-03 07:41:57 | christian.heimes | set | priority: release blocker -> critical assignee: asvetlov messages: + msg392776 |
| 2021-05-03 07:39:05 | christian.heimes | set | messages: + msg392775 |
| 2021-05-03 07:32:22 | christian.heimes | set | nosy:
- xtreak type: enhancement messages: + msg392774 |
| 2021-05-03 07:16:17 | xtreak | set | nosy:
+ xtreak messages: + msg392771 |
| 2021-05-03 06:38:53 | xtreak | set | nosy:
+ pablogsal |
| 2021-05-03 06:37:20 | christian.heimes | set | pull_requests: + pull_request24524 |
| 2021-05-03 06:32:51 | christian.heimes | set | priority: normal -> release blocker nosy: + christian.heimes messages: + msg392769 |
| 2021-05-02 21:34:22 | asvetlov | set | messages: + msg392739 |
| 2021-05-02 20:34:03 | asvetlov | set | keywords:
+ patch stage: patch review pull_requests: + pull_request24507 |
| 2021-05-02 20:33:40 | asvetlov | create | |

