Navigation Menu

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_sock_client_fail() changes asyncio.events._event_loop_policy #90864

Closed
vstinner opened this issue Feb 10, 2022 · 5 comments
Closed
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes tests Tests in the Lib/test dir topic-asyncio

Comments

@vstinner
Copy link
Member

BPO 46708
Nosy @gvanrossum, @vstinner, @asvetlov, @1st1
PRs
  • bpo-46708: Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio #31253
  • [3.10] bpo-46708: Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253) #31255
  • [3.9] bpo-46708: Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253) #31256
  • 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 2022-02-10.13:32:35.481>
    created_at = <Date 2022-02-10.11:53:56.166>
    labels = ['3.11', 'tests', '3.9', '3.10', 'expert-asyncio']
    title = 'test_asyncio: test_sock_client_fail() changes asyncio.events._event_loop_policy'
    updated_at = <Date 2022-02-11.22:19:34.139>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2022-02-11.22:19:34.139>
    actor = 'gvanrossum'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-02-10.13:32:35.481>
    closer = 'asvetlov'
    components = ['Tests', 'asyncio']
    creation = <Date 2022-02-10.11:53:56.166>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46708
    keywords = ['patch']
    message_count = 5.0
    messages = ['412991', '412992', '412994', '412999', '413103']
    nosy_count = 4.0
    nosy_names = ['gvanrossum', 'vstinner', 'asvetlov', 'yselivanov']
    pr_nums = ['31253', '31255', '31256']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue46708'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @vstinner
    Copy link
    Member Author

    Seen on s390x RHEL7 Refleaks 3.x:
    https://buildbot.python.org/all/#/builders/129/builds/300

    == Tests result: FAILURE ==
    (...)
    3 tests failed:
    test_asyncio test_importlib test_unittest
    (...)
    0:36:44 load avg: 0.50 Re-running test_asyncio in verbose mode (matching: test_sock_client_fail)
    beginning 6 repetitions
    123456
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests) ... ok
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests) ... ok
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests) ... ok

    ----------------------------------------------------------------------
    Ran 3 tests in 0.062s

    OK
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests) ... ok
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests) ... ok
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests) ... ok

    ----------------------------------------------------------------------
    Ran 3 tests in 0.061s

    OK
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests) ... ok
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests) ... ok
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests) ... ok

    ----------------------------------------------------------------------
    Ran 3 tests in 0.055s

    OK
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests) ... ok
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests) ... ok
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests) ... ok

    ----------------------------------------------------------------------
    Ran 3 tests in 0.053s

    OK
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests) ... ok
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests) ... ok
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests) ... ok

    ----------------------------------------------------------------------
    Ran 3 tests in 0.060s

    OK
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.EPollEventLoopTests) ... ok
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.PollEventLoopTests) ... ok
    test_sock_client_fail (test.test_asyncio.test_sock_lowlevel.SelectEventLoopTests) ... ok

    ----------------------------------------------------------------------
    Ran 3 tests in 0.060s

    OK
    ......
    Warning -- asyncio.events._event_loop_policy was modified by test_asyncio
    Warning -- Before: None
    Warning -- After: <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x3ff9cac3f80>

    @vstinner vstinner added 3.11 only security fixes tests Tests in the Lib/test dir topic-asyncio labels Feb 10, 2022
    @vstinner
    Copy link
    Member Author

    By default, asyncio.events._event_loop_policy is None:

    $ ./python -i
    >>> import asyncio; asyncio.events._event_loop_policy is None
    True

    After running the test, it changes:

    vstinner@apu$ ./python -i
    Python 3.11.0a5+ (heads/main:46328d8ae6, Feb  9 2022, 21:25:58) [GCC 11.2.1 20211203 (Red Hat 11.2.1-7)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import asyncio; asyncio.events._event_loop_policy is None
    True
    >>> 
    vstinner@apu$ ./python -i -m test test_asyncio -m test_sock_client_fail
    (...)
    Tests result: SUCCESS
    (...)
    SystemExit: 0
    >>> import asyncio; asyncio.events._event_loop_policy
    <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7ff7286e7530>

    @asvetlov
    Copy link
    Contributor

    Thanks for the report!
    Let me make a fix PR in a few minutes

    @asvetlov asvetlov added 3.9 only security fixes 3.10 only security fixes labels Feb 10, 2022
    @vstinner
    Copy link
    Member Author

    With PR 31253 fix, I confirm that it fix my bug explained in msg412992.

    commit 012e77e
    Author: Andrew Svetlov <andrew.svetlov@gmail.com>
    Date: Thu Feb 10 14:57:20 2022 +0200

    Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253)
    

    @gvanrossum
    Copy link
    Member

    Heh, I just ran into this for test_taskgroups as well. (Alas, I had debugged and fixed it independently before I found this. :-)

    @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.9 only security fixes 3.10 only security fixes 3.11 only security fixes tests Tests in the Lib/test dir topic-asyncio
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants