Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-4537

Async pymongo fails on Windows: AutoReconnect: localhost:27017: [WinError 87] The parameter is incorrect

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Context

      Async pymongo tests are failing on Windows:

       [2024/07/04 08:36:12.185] Traceback (most recent call last):
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\pymongo\asynchronous\pool.py", line 536, in command
       [2024/07/04 08:36:12.185]     return await command(
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\pymongo\asynchronous\network.py", line 203, in command
       [2024/07/04 08:36:12.185]     await async_sendall(conn.conn, msg)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\pymongo\network_layer.py", line 43, in async_sendall
       [2024/07/04 08:36:12.185]     await asyncio.wait_for(loop.sock_sendall(socket, buf), timeout=timeout)  # type: ignore[arg-type]
       [2024/07/04 08:36:12.185]   File "C:\python\Python310\lib\asyncio\tasks.py", line 408, in wait_for
       [2024/07/04 08:36:12.185]     return await fut
       [2024/07/04 08:36:12.185]   File "C:\python\Python310\lib\asyncio\proactor_events.py", line 706, in sock_sendall
       [2024/07/04 08:36:12.185]     return await self._proactor.send(sock, data)
       [2024/07/04 08:36:12.185]   File "C:\python\Python310\lib\asyncio\windows_events.py", line 543, in send
       [2024/07/04 08:36:12.185]     self._register_with_iocp(conn)
       [2024/07/04 08:36:12.185]   File "C:\python\Python310\lib\asyncio\windows_events.py", line 732, in _register_with_iocp
       [2024/07/04 08:36:12.185]     _overlapped.CreateIoCompletionPort(obj.fileno(), self._iocp, 0, 0)
       [2024/07/04 08:36:12.185] OSError: [WinError 87] The parameter is incorrect
       [2024/07/04 08:36:12.185] The above exception was the direct cause of the following exception:
       [2024/07/04 08:36:12.185] Traceback (most recent call last):
       [2024/07/04 08:36:12.185]   File "C:\python\Python310\lib\runpy.py", line 196, in _run_module_as_main
       [2024/07/04 08:36:12.185]     return _run_code(code, main_globals, None,
       [2024/07/04 08:36:12.185]   File "C:\python\Python310\lib\runpy.py", line 86, in _run_code
       [2024/07/04 08:36:12.185]     exec(code, run_globals)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pytest\__main__.py", line 7, in <module>
       [2024/07/04 08:36:12.185]     raise SystemExit(pytest.console_main())
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\_pytest\config\__init__.py", line 206, in console_main
       [2024/07/04 08:36:12.185]     code = main()
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\_pytest\config\__init__.py", line 178, in main
       [2024/07/04 08:36:12.185]     ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pluggy\_hooks.py", line 513, in __call__
       [2024/07/04 08:36:12.185]     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
       [2024/07/04 08:36:12.185]     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pluggy\_callers.py", line 139, in _multicall
       [2024/07/04 08:36:12.185]     raise exception.with_traceback(exception.__traceback__)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pluggy\_callers.py", line 103, in _multicall
       [2024/07/04 08:36:12.185]     res = hook_impl.function(*args)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\_pytest\main.py", line 332, in pytest_cmdline_main
       [2024/07/04 08:36:12.185]     return wrap_session(config, _main)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\_pytest\main.py", line 320, in wrap_session
       [2024/07/04 08:36:12.185]     config.hook.pytest_sessionfinish(
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pluggy\_hooks.py", line 513, in __call__
       [2024/07/04 08:36:12.185]     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
       [2024/07/04 08:36:12.185]     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pluggy\_callers.py", line 139, in _multicall
       [2024/07/04 08:36:12.185]     raise exception.with_traceback(exception.__traceback__)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pluggy\_callers.py", line 122, in _multicall
       [2024/07/04 08:36:12.185]     teardown.throw(exception)  # type: ignore[union-attr]
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\_pytest\logging.py", line 872, in pytest_sessionfinish
       [2024/07/04 08:36:12.185]     return (yield)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pluggy\_callers.py", line 122, in _multicall
       [2024/07/04 08:36:12.185]     teardown.throw(exception)  # type: ignore[union-attr]
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\_pytest\terminal.py", line 867, in pytest_sessionfinish
       [2024/07/04 08:36:12.185]     result = yield
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pluggy\_callers.py", line 122, in _multicall
       [2024/07/04 08:36:12.185]     teardown.throw(exception)  # type: ignore[union-attr]
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\_pytest\warnings.py", line 140, in pytest_sessionfinish
       [2024/07/04 08:36:12.185]     return (yield)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pluggy\_callers.py", line 103, in _multicall
       [2024/07/04 08:36:12.185]     res = hook_impl.function(*args)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\_pytest\runner.py", line 110, in pytest_sessionfinish
       [2024/07/04 08:36:12.185]     session._setupstate.teardown_exact(None)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\_pytest\runner.py", line 557, in teardown_exact
       [2024/07/04 08:36:12.185]     raise exceptions[0]
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\_pytest\runner.py", line 546, in teardown_exact
       [2024/07/04 08:36:12.185]     fin()
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\_pytest\fixtures.py", line 1023, in finish
       [2024/07/04 08:36:12.185]     raise exceptions[0]
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\_pytest\fixtures.py", line 1012, in finish
       [2024/07/04 08:36:12.185]     fin()
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pytest_asyncio\plugin.py", line 342, in finalizer
       [2024/07/04 08:36:12.185]     event_loop.run_until_complete(async_finalizer())
       [2024/07/04 08:36:12.185]   File "C:\python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
       [2024/07/04 08:36:12.185]     return future.result()
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\.tox\test-eg\lib\site-packages\pytest_asyncio\plugin.py", line 334, in async_finalizer
       [2024/07/04 08:36:12.185]     await gen_obj.__anext__()
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\test\asynchronous\conftest.py", line 14, in test_setup_and_teardown
       [2024/07/04 08:36:12.185]     await async_teardown()
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\test\asynchronous\__init__.py", line 1012, in async_teardown
       [2024/07/04 08:36:12.185]     await c.drop_database("pymongo-pooling-tests")
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\pymongo\_csot.py", line 110, in csot_wrapper
       [2024/07/04 08:36:12.185]     return await func(self, *args, **kwargs)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\pymongo\asynchronous\mongo_client.py", line 2194, in drop_database
       [2024/07/04 08:36:12.185]     await self[name]._command(
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\pymongo\asynchronous\database.py", line 743, in _command
       [2024/07/04 08:36:12.185]     return await conn.command(
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\pymongo\asynchronous\helpers.py", line 45, in inner
       [2024/07/04 08:36:12.185]     return await func(*args, **kwargs)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\pymongo\asynchronous\pool.py", line 564, in command
       [2024/07/04 08:36:12.185]     self._raise_connection_failure(error)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\pymongo\asynchronous\pool.py", line 763, in _raise_connection_failure
       [2024/07/04 08:36:12.185]     _raise_connection_failure(self.address, error, timeout_details=details)
       [2024/07/04 08:36:12.185]   File "Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src\pymongo\asynchronous\pool.py", line 206, in _raise_connection_failure
       [2024/07/04 08:36:12.186]     raise AutoReconnect(msg) from error
       [2024/07/04 08:36:12.186] pymongo.errors.AutoReconnect: localhost:27017: [WinError 87] The parameter is incorrect (configured timeouts: connectTimeoutMS: 20000.0ms)
       [2024/07/04 08:36:12.815] test/asynchronous/test_collection.py::AsyncTestCollection::test_cursor_timeout FAILED [  3%]test-eg: exit 1 (27.05 seconds) Z:\data\mci\ec8906aea3ef41440ecdf40d5433c483\src> bash ./.evergreen/run-tests.sh pid=5408 


      https://spruce.mongodb.com/task/mongo_python_driver_tests_windows_encryption__platform~windows_64_vsMulti_small_auth_ssl~noauth_nossl_python_version_windows~3.10_encryption~encryption_test_4.0_replica_set_f5b102ab2a496f5b5e8acce1bcd8bf27f721a075_24_07_03_00_03_10?execution=0&sortBy=STATUS&sortDir=ASC 

            Assignee:
            noah.stapp@mongodb.com Noah Stapp
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: