Skip to content

test_asyncio: test_start_tls_server_1() fails on Python on x86 Windows7 3.7 and 3.x #77875

Closed

Description

@vstinner
BPO 33694
Nosy @vstinner, @ned-deily, @miss-islington
PRs
  • WIP: bpo-33694, asyncio: fix proactor transport pause/resume #7479
  • bpo-33694: asyncio: Fix race in Proactor's Transport.set_protocol() #7486
  • bpo-33694: Fix race condition on proactor recv() #7498
  • [3.7] bpo-33694: Fix race condition in asyncio proactor (GH-7498) #7499
  • bpo-33694: Fix typo in asyncio helper function name #7522
  • [3.7] bpo-33694: Fix typo in helper function name (GH-7522) #7523
  • bpo-33694: Remove test_asyncio ProactorDatagramTransportTests #16288
  • [3.8] bpo-33694: Remove test_asyncio ProactorDatagramTransportTests (GH-16288) #16305
  • Files
  • Screen Shot 2018-05-30 at 11.38.38 AM.png
  • race.py
  • 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 2018-06-09.16:44:39.217>
    created_at = <Date 2018-05-30.11:19:38.205>
    labels = ['3.8', '3.7', 'tests', 'expert-asyncio']
    title = 'test_asyncio: test_start_tls_server_1() fails on Python on x86 Windows7 3.7 and 3.x'
    updated_at = <Date 2019-09-20.21:27:31.745>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2019-09-20.21:27:31.745>
    actor = 'miss-islington'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-06-09.16:44:39.217>
    closer = 'vstinner'
    components = ['Tests', 'asyncio']
    creation = <Date 2018-05-30.11:19:38.205>
    creator = 'vstinner'
    dependencies = []
    files = ['47626', '47632']
    hgrepos = []
    issue_num = 33694
    keywords = ['patch']
    message_count = 32.0
    messages = ['318164', '318165', '318193', '318194', '318195', '318209', '318424', '318569', '318705', '318707', '318809', '318869', '318872', '318873', '318874', '318875', '318876', '318915', '318921', '318977', '318979', '318993', '319034', '319035', '319155', '319175', '319209', '319220', '319299', '319450', '352891', '352894']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'ned.deily', 'miss-islington']
    pr_nums = ['7479', '7486', '7498', '7499', '7522', '7523', '16288', '16305']
    priority = None
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue33694'
    versions = ['Python 3.7', 'Python 3.8']

    Activity

    1. vstinner commented on May 30, 2018

      @vstinner
      MemberAuthor

      test_asyncio.test_start_tls_server_1() got many fixes recently: see bpo-32458 and bpo-33674... but it still fails on Python on x86 Windows7 3.x at revision bb9474f which contains all these fixes.

      The test fails even when test_asyncio is re-run alone (not when other tests run in parallel).

      http://buildbot.python.org/all/#/builders/58/builds/930

      ======================================================================
      ERROR: test_start_tls_server_1 (test.test_asyncio.test_sslproto.ProactorStartTLSTests)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_asyncio\test_sslproto.py", line 467, in test_start_tls_server_1
          self.loop.run_until_complete(run_main())
        File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\asyncio\base_events.py", line 566, in run_until_complete
          raise RuntimeError('Event loop stopped before Future completed.')
      RuntimeError: Event loop stopped before Future completed.

      ======================================================================
      FAIL: test_start_tls_server_1 (test.test_asyncio.test_sslproto.ProactorStartTLSTests)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_asyncio\functional.py", line 42, in tearDown
          self.fail('unexpected calls to loop.call_exception_handler()')
      AssertionError: unexpected calls to loop.call_exception_handler()

      The test fails also on x86 Windows7 3.7:

      ======================================================================
      ERROR: test_start_tls_server_1 (test.test_asyncio.test_sslproto.ProactorStartTLSTests)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\test_asyncio\test_sslproto.py", line 467, in test_start_tls_server_1
          self.loop.run_until_complete(run_main())
        File "D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\asyncio\base_events.py", line 566, in run_until_complete
          raise RuntimeError('Event loop stopped before Future completed.')
      RuntimeError: Event loop stopped before Future completed.

      ======================================================================
      FAIL: test_start_tls_server_1 (test.test_asyncio.test_sslproto.ProactorStartTLSTests)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\test_asyncio\functional.py", line 42, in tearDown
          self.fail('unexpected calls to loop.call_exception_handler()')
      AssertionError: unexpected calls to loop.call_exception_handler()

      Moreover, 3.7 got an additional failure:

      ======================================================================
      ERROR: test_pipe_handle (test.test_asyncio.test_windows_utils.PipeTests)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "D:\cygwin\home\db3l\buildarea\3.7.bolen-windows7\build\lib\test\test_asyncio\test_windows_utils.py", line 73, in test_pipe_handle
          raise RuntimeError('expected ERROR_INVALID_HANDLE')
      RuntimeError: expected ERROR_INVALID_HANDLE

      The Windows7 buildbot is known to be slow. For example, test_value() of test_multiprocessing_spawn failed with a timeout (15 min) on x86 Windows7 3.x:

      0:48:12 [276/416/1] test_multiprocessing_spawn crashed (Exit code 1)
      Timeout (0:15:00)!
      Thread 0x000008e4 (most recent call first):
      File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\multiprocessing\popen_spawn_win32.py", line 80 in wait
      File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\multiprocessing\process.py", line 140 in join
      File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\_test_multiprocessing.py", line 1925 in test_value

      Maybe something is wrong with my karma, I don't know. Or test_asyncio just hate me.

    2. added
      3.7 (EOL)
      3.8 (EOL)
      tests
      on May 30, 2018
    3. vstinner commented on May 30, 2018

      @vstinner
      MemberAuthor

      The test fails also on x86 Windows7 3.7:
      http://buildbot.python.org/all/#/builders/111/builds/297

    4. 1st1 commented on May 30, 2018

      @1st1
      Member

      I can't reproduce test_start_tls_server_1 fails when I do (screenshot attached)

      1. run test_asyncio
      2. run test_asyncio.test_sslproto
      3. run test_asyncio.test_sslproto -m test_start_tls_server_1

      I run them in Windows 7 VM on Mac OS.

      All other tests pass fine for me except test_sendfile_close_peer_in_the_middle_of_receiving. Andrew, please look at this, this is your test, and I'm not sure I follow why we use SNDBUF at all. IMO it should be possible to write a test without using that (or if not, maybe time to use mocks).

      With regards to start_tls tests -- I give up, I don't have time to look into this before 3.7.0. I suggest to mask the test on the specific win buildbot it crashes on and fix it before 3.7.1 (or maybe when Windows users come up with a reliable way to reproduce the bug).

    5. asvetlov commented on May 30, 2018

      @asvetlov
      Contributor

      I used SNDBUF to enforce send buffer overloading.
      It is not required by sendfile tests but I thought that better to have non-mocked way to test such situations.
      We can remove the socket buffers size manipulation at all without any problem.

    6. 1st1 commented on May 30, 2018

      @1st1
      Member

      We can remove the socket buffers size manipulation at all without any problem.

      When I tried to do that I think I was having more failures with that test. But really up to you.

    7. vstinner commented on May 30, 2018

      @vstinner
      MemberAuthor

      I used SNDBUF to enforce send buffer overloading.

      What is that? Would you mind to elaborate? I'm curious :-)

    8. vstinner commented on Jun 1, 2018

      @vstinner
      MemberAuthor

      The test also failed on AMD64 Windows8.1 Refleaks 3.7. This buildbot is also very slow because it runs reference leak hunting. It confirms that the remaining issue is a race condition which is only seen when the system becomes slow.

      http://buildbot.python.org/all/#/builders/132/builds/154

      ======================================================================
      ERROR: test_start_tls_server_1 (test.test_asyncio.test_sslproto.ProactorStartTLSTests)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "D:\buildarea\3.7.ware-win81-release.refleak\build\lib\test\test_asyncio\test_sslproto.py", line 467, in test_start_tls_server_1
          self.loop.run_until_complete(run_main())
        File "D:\buildarea\3.7.ware-win81-release.refleak\build\lib\asyncio\base_events.py", line 566, in run_until_complete
          raise RuntimeError('Event loop stopped before Future completed.')
      RuntimeError: Event loop stopped before Future completed.

      ======================================================================
      FAIL: test_start_tls_server_1 (test.test_asyncio.test_sslproto.ProactorStartTLSTests)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "D:\buildarea\3.7.ware-win81-release.refleak\build\lib\test\test_asyncio\functional.py", line 42, in tearDown
          self.fail('unexpected calls to loop.call_exception_handler()')
      AssertionError: unexpected calls to loop.call_exception_handler()
    9. pablogsal commented on Jun 3, 2018

      @pablogsal
      Member

      The test fails also on x86 Windows7 3.x:
      http://buildbot.python.org/all/#/builders/58/builds/947

    10. vstinner commented on Jun 4, 2018

      @vstinner
      MemberAuthor

      A variant of the bug?

      AMD64 Windows8.1 Non-Debug 3.x:
      http://buildbot.python.org/all/#/builders/12/builds/948

      ======================================================================
      ERROR: test_create_connection_ssl_failed_certificate (test.test_asyncio.test_sslproto.ProactorStartTLSTests)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "D:\buildarea\3.x.ware-win81-release\build\lib\test\test_asyncio\test_sslproto.py", line 623, in test_create_connection_ssl_failed_certificate
          self.loop.run_until_complete(client(srv.addr))
        File "D:\buildarea\3.x.ware-win81-release\build\lib\asyncio\base_events.py", line 566, in run_until_complete
          raise RuntimeError('Event loop stopped before Future completed.')
      RuntimeError: Event loop stopped before Future completed.
    11. vstinner commented on Jun 4, 2018

      @vstinner
      MemberAuthor

      AMD64 Windows8.1 Non-Debug 3.x
      ERROR: test_create_connection_ssl_failed_certificate (test.test_asyncio.test_sslproto.ProactorStartTLSTests)

      Not surprising: same error on AMD64 Windows8.1 Non-Debug 3.7:
      http://buildbot.python.org/all/#builders/133/builds/304

    12. vstinner commented on Jun 6, 2018

      @vstinner
      MemberAuthor

      Another variant seen on AppVeyor (PR 7439, master branch):

      https://ci.appveyor.com/project/python/cpython/build/3.8build16980

      ======================================================================
      ERROR: test_create_connection_ssl_failed_certificate (test.test_asyncio.test_sslproto.ProactorStartTLSTests)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "C:\projects\cpython\lib\test\test_asyncio\test_sslproto.py", line 623, in test_create_connection_ssl_failed_certificate
          self.loop.run_until_complete(client(srv.addr))
        File "C:\projects\cpython\lib\asyncio\base_events.py", line 566, in run_until_complete
          raise RuntimeError('Event loop stopped before Future completed.')
      RuntimeError: Event loop stopped before Future completed.

    13. 10 remaining items

    14. vstinner commented on Jun 7, 2018

      @vstinner
      MemberAuthor

      New changeset 8fa398d by Victor Stinner (Miss Islington (bot)) in branch '3.7':
      bpo-33694: Fix race condition in asyncio proactor (GH-7498) (GH-7499)
      8fa398d

    15. vstinner commented on Jun 8, 2018

      @vstinner
      MemberAuthor

      I fixed the root issue, a race condition in ProactorEventLoop. But I prefer to keep the issue open a few days to see if the bug is really gone from all CIs.

    16. vstinner commented on Jun 8, 2018

      @vstinner
      MemberAuthor

      New changeset ff6c077 by Victor Stinner in branch 'master':
      bpo-33694: Fix typo in helper function name (GH-7522)
      ff6c077

    17. miss-islington commented on Jun 8, 2018

      @miss-islington
      Contributor

      New changeset 17beebc by Miss Islington (bot) in branch '3.7':
      bpo-33694: Fix typo in helper function name (GH-7522)
      17beebc

    18. vstinner commented on Jun 9, 2018

      @vstinner
      MemberAuthor

      I ran attached race.py on the 3.6 branch:

      • 2000 packets of 16 KiB: ok
      • 50 packets of 16 MiB: ok

      It seems like Python 3.6 (at least the 3.6 development branch) doesn't have this bug.

      It didn't see the bug recently, so I close the issue.

      Python 3.6 has a different issue: pause_reading() cannot be called twice, same issue with resume_reading(). But I'm not sure that it can be called a bug. Python 3.7 allows to call these methods twice and to call these methods while closing: they just do nothing in that case.

      I close the issue.

    19. 1st1 commented on Jun 9, 2018

      @1st1
      Member

      pause_reading and resume_reading became idempotent only in 3.7

    20. vstinner commented on Jun 10, 2018

      @vstinner
      MemberAuthor

      pause_reading and resume_reading became idempotent only in 3.7

      Do you consider that it's a new feature or a bugfix? Should we backport this change to 3.6? Currently, race.py fails with an error because of the 3.6 behaviour. (I modified asyncio to be able to run race.py on 3.6.)

    21. 1st1 commented on Jun 10, 2018

      @1st1
      Member

      Since it a minor change we can reconsider it as s bug fix. Feel free to make a pr.

    22. vstinner commented on Jun 11, 2018

      @vstinner
      MemberAuthor

      "Since it a minor change we can reconsider it as s bug fix. Feel free
      to make a pr."

      Ok, I created #7629 for bpo-32356

    23. vstinner commented on Jun 13, 2018

      @vstinner
      MemberAuthor

      New changeset 142e3c0 by Victor Stinner in branch '3.6':
      [3.6] bpo-32356: idempotent pause_/resume_reading (GH-4914) (GH-7629)
      142e3c0

    24. vstinner commented on Sep 20, 2019

      @vstinner
      MemberAuthor

      New changeset bc2256e by Victor Stinner in branch 'master':
      bpo-33694: Remove test_asyncio ProactorDatagramTransportTests (GH-16288)
      bc2256e

    25. miss-islington commented on Sep 20, 2019

      @miss-islington
      Contributor

      New changeset b50edac by Miss Islington (bot) in branch '3.8':
      bpo-33694: Remove test_asyncio ProactorDatagramTransportTests (GH-16288)
      b50edac

    26. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)3.8 (EOL)teststopic-asyncio

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions