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

[Build Failure] test_command_cursor_to_list_csot_applied on MacOS

    • Type: Icon: Build Failure Build Failure
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.11
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Not Needed
    • 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?

      Name of Failure:

      test.asynchronous.test_cursor.TestCursor.test_command_cursor_to_list_csot_applied

      Link to task:

      https://spruce.mongodb.com/task/mongo_python_driver_test_macos__platform~macos_auth~auth_ssl~ssl_test_7.0_sharded_cluster_patch_4eeaa4b7be9e814fd207166904f42556c10ce63b_670a5898d5e8bd00075547c4_24_10_12_11_08_36/tests?execution=0&sortBy=STATUS&sortDir=ASC

      Context of when and why the failure occurred:

      We should skip this CSOT-related test on MacOS.

      Stack trace:

       [2024/10/12 06:59:14.255] FAILURE: pymongo.errors.NetworkTimeout: localhost:27017: timed out (configured timeouts: timeoutMS: 500.0ms, connectTimeoutMS: 20000.0ms) ()
       [2024/10/12 06:59:14.255] self = AsyncConnection(<ssl.SSLSocket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>) CLOSED at 4487551136
       [2024/10/12 06:59:14.255] request_id = 1889101406
       [2024/10/12 06:59:14.255]     async def receive_message(self, request_id: Optional[int]) -> Union[_OpReply, _OpMsg]:
       [2024/10/12 06:59:14.255]         """Receive a raw BSON message or raise ConnectionFailure.
       [2024/10/12 06:59:14.255]     
       [2024/10/12 06:59:14.255]         If any exception is raised, the socket is closed.
       [2024/10/12 06:59:14.255]         """
       [2024/10/12 06:59:14.255]         try:
       [2024/10/12 06:59:14.255] >           return await receive_message(self, request_id, self.max_message_size)
       [2024/10/12 06:59:14.255] pymongo/asynchronous/pool.py:590: 
       [2024/10/12 06:59:14.255] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
       [2024/10/12 06:59:14.255] pymongo/asynchronous/network.py:315: in receive_message
       [2024/10/12 06:59:14.255]     length, _, response_to, op_code = _UNPACK_HEADER(await async_receive_data(conn, 16, deadline))
       [2024/10/12 06:59:14.255] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
       [2024/10/12 06:59:14.255] conn = AsyncConnection(<ssl.SSLSocket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>) CLOSED at 4487551136
       [2024/10/12 06:59:14.255] length = 16, deadline = 16308.694476461
       [2024/10/12 06:59:14.255]     async def async_receive_data(
       [2024/10/12 06:59:14.255]         conn: AsyncConnection, length: int, deadline: Optional[float]
       [2024/10/12 06:59:14.255]     ) -> memoryview:
       [2024/10/12 06:59:14.255]         sock = conn.conn
       [2024/10/12 06:59:14.255]         sock_timeout = sock.gettimeout()
       [2024/10/12 06:59:14.255]         timeout: Optional[Union[float, int]]
       [2024/10/12 06:59:14.255]         if deadline:
       [2024/10/12 06:59:14.255]             # When the timeout has expired perform one final check to
       [2024/10/12 06:59:14.255]             # see if the socket is readable. This helps avoid spurious
       [2024/10/12 06:59:14.255]             # timeouts on AWS Lambda and other FaaS environments.
       [2024/10/12 06:59:14.255]             timeout = max(deadline - time.monotonic(), 0)
       [2024/10/12 06:59:14.255]         else:
       [2024/10/12 06:59:14.255]             timeout = sock_timeout
       [2024/10/12 06:59:14.255]     
       [2024/10/12 06:59:14.255]         sock.settimeout(0.0)
       [2024/10/12 06:59:14.255]         loop = asyncio.get_event_loop()
       [2024/10/12 06:59:14.255]         cancellation_task = asyncio.create_task(_poll_cancellation(conn))
       [2024/10/12 06:59:14.255]         try:
       [2024/10/12 06:59:14.255]             if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
       [2024/10/12 06:59:14.255]                 read_task = asyncio.create_task(_async_receive_ssl(sock, length, loop))  # type: ignore[arg-type]
       [2024/10/12 06:59:14.255]             else:
       [2024/10/12 06:59:14.255]                 read_task = asyncio.create_task(_async_receive(sock, length, loop))  # type: ignore[arg-type]
       [2024/10/12 06:59:14.255]             tasks = [read_task, cancellation_task]
       [2024/10/12 06:59:14.255]             done, pending = await asyncio.wait(
       [2024/10/12 06:59:14.255]                 tasks, timeout=timeout, return_when=asyncio.FIRST_COMPLETED
       [2024/10/12 06:59:14.255]             )
       [2024/10/12 06:59:14.255]             for task in pending:
       [2024/10/12 06:59:14.255]                 task.cancel()
       [2024/10/12 06:59:14.255]             await asyncio.wait(pending)
       [2024/10/12 06:59:14.255]             if len(done) == 0:
       [2024/10/12 06:59:14.255] >               raise socket.timeout("timed out")
       [2024/10/12 06:59:14.255] E               TimeoutError: timed out
       [2024/10/12 06:59:14.255] pymongo/network_layer.py:273: TimeoutError
       [2024/10/12 06:59:14.255] The above exception was the direct cause of the following exception:
       [2024/10/12 06:59:14.255] self = <test.asynchronous.test_cursor.TestCursor testMethod=test_command_cursor_to_list_csot_applied>
       [2024/10/12 06:59:14.255]     @async_client_context.require_failCommand_blockConnection
       [2024/10/12 06:59:14.255]     async def test_command_cursor_to_list_csot_applied(self):
       [2024/10/12 06:59:14.255]         client = await self.async_single_client(timeoutMS=500)
       [2024/10/12 06:59:14.255]         # Initialize the client with a larger timeout to help make test less flakey
       [2024/10/12 06:59:14.255]         with pymongo.timeout(10):
       [2024/10/12 06:59:14.255]             await client.admin.command("ping")
       [2024/10/12 06:59:14.255]         coll = client.pymongo.test
       [2024/10/12 06:59:14.255] >       await coll.insert_many([{} for _ in range(5)])
       [2024/10/12 06:59:14.255] test/asynchronous/test_cursor.py:1462: 
       [2024/10/12 06:59:14.255] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
       [2024/10/12 06:59:14.255] pymongo/_csot.py:108: in csot_wrapper
       [2024/10/12 06:59:14.255]     return await func(self, *args, **kwargs)
       [2024/10/12 06:59:14.255] pymongo/asynchronous/collection.py:976: in insert_many
       [2024/10/12 06:59:14.255]     await blk.execute(write_concern, session, _Op.INSERT)
       [2024/10/12 06:59:14.255] pymongo/asynchronous/bulk.py:738: in execute
       [2024/10/12 06:59:14.255]     return await self.execute_command(generator, write_concern, session, operation)
       [2024/10/12 06:59:14.255] pymongo/asynchronous/bulk.py:593: in execute_command
       [2024/10/12 06:59:14.255]     _ = await client._retryable_write(
       [2024/10/12 06:59:14.255] pymongo/asynchronous/mongo_client.py:1903: in _retryable_write
       [2024/10/12 06:59:14.255]     return await self._retry_with_session(retryable, func, s, bulk, operation, operation_id)
       [2024/10/12 06:59:14.255] pymongo/asynchronous/mongo_client.py:1789: in _retry_with_session
       [2024/10/12 06:59:14.255]     return await self._retry_internal(
       [2024/10/12 06:59:14.255] pymongo/_csot.py:109: in csot_wrapper
       [2024/10/12 06:59:14.255]     return await func(self, *args, **kwargs)
       [2024/10/12 06:59:14.255] pymongo/asynchronous/mongo_client.py:1824: in _retry_internal
       [2024/10/12 06:59:14.255]     return await _ClientConnectionRetryable(
       [2024/10/12 06:59:14.255] pymongo/asynchronous/mongo_client.py:2565: in run
       [2024/10/12 06:59:14.255]     self._check_last_error(check_csot=True)
       [2024/10/12 06:59:14.255] pymongo/asynchronous/mongo_client.py:2651: in _check_last_error
       [2024/10/12 06:59:14.255]     raise self._last_error
       [2024/10/12 06:59:14.255] pymongo/asynchronous/mongo_client.py:2567: in run
       [2024/10/12 06:59:14.255]     return await self._read() if self._is_read else await self._write()
       [2024/10/12 06:59:14.255] pymongo/asynchronous/mongo_client.py:2689: in _write
       [2024/10/12 06:59:14.255]     return await self._func(self._session, conn, self._retryable)  # type: ignore
       [2024/10/12 06:59:14.255] pymongo/asynchronous/bulk.py:582: in retryable_bulk
       [2024/10/12 06:59:14.255]     await self._execute_command(
       [2024/10/12 06:59:14.255] pymongo/asynchronous/bulk.py:527: in _execute_command
       [2024/10/12 06:59:14.255]     result, to_send = await self._execute_batch(bwc, cmd, ops, client)
       [2024/10/12 06:59:14.255] pymongo/asynchronous/bulk.py:451: in _execute_batch
       [2024/10/12 06:59:14.255]     result = await self.write_command(bwc, cmd, request_id, msg, to_send, client)  # type: ignore[arg-type]
       [2024/10/12 06:59:14.255] pymongo/asynchronous/helpers.py:45: in inner
       [2024/10/12 06:59:14.255]     return await func(*args, **kwargs)
       [2024/10/12 06:59:14.255] pymongo/asynchronous/bulk.py:263: in write_command
       [2024/10/12 06:59:14.255]     reply = await bwc.conn.write_command(request_id, msg, bwc.codec)  # type: ignore[misc]
       [2024/10/12 06:59:14.255] pymongo/asynchronous/pool.py:624: in write_command
       [2024/10/12 06:59:14.255]     reply = await self.receive_message(request_id)
       [2024/10/12 06:59:14.255] pymongo/asynchronous/pool.py:592: in receive_message
       [2024/10/12 06:59:14.255]     self._raise_connection_failure(error)
       [2024/10/12 06:59:14.255] pymongo/asynchronous/pool.py:765: in _raise_connection_failure
       [2024/10/12 06:59:14.255]     _raise_connection_failure(self.address, error, timeout_details=details)
       [2024/10/12 06:59:14.255] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
       [2024/10/12 06:59:14.255] address = ('localhost', 27017), error = TimeoutError('timed out')
       [2024/10/12 06:59:14.255] msg_prefix = None
       [2024/10/12 06:59:14.255] timeout_details = {'connectTimeoutMS': 20000.0, 'timeoutMS': 500.0}
       [2024/10/12 06:59:14.255]     def _raise_connection_failure(
       [2024/10/12 06:59:14.255]         address: Any,
       [2024/10/12 06:59:14.255]         error: Exception,
       [2024/10/12 06:59:14.255]         msg_prefix: Optional[str] = None,
       [2024/10/12 06:59:14.255]         timeout_details: Optional[dict[str, float]] = None,
       [2024/10/12 06:59:14.255]     ) -> NoReturn:
       [2024/10/12 06:59:14.255]         """Convert a socket.error to ConnectionFailure and raise it."""
       [2024/10/12 06:59:14.255]         host, port = address
       [2024/10/12 06:59:14.255]         # If connecting to a Unix socket, port will be None.
       [2024/10/12 06:59:14.255]         if port is not None:
       [2024/10/12 06:59:14.255]             msg = "%s:%d: %s" % (host, port, error)
       [2024/10/12 06:59:14.255]         else:
       [2024/10/12 06:59:14.255]             msg = f"{host}: {error}"
       [2024/10/12 06:59:14.255]         if msg_prefix:
       [2024/10/12 06:59:14.255]             msg = msg_prefix + msg
       [2024/10/12 06:59:14.255]         if "configured timeouts" not in msg:
       [2024/10/12 06:59:14.255]             msg += format_timeout_details(timeout_details)
       [2024/10/12 06:59:14.255]         if isinstance(error, socket.timeout):
       [2024/10/12 06:59:14.255] >           raise NetworkTimeout(msg) from error
       [2024/10/12 06:59:14.255] E           pymongo.errors.NetworkTimeout: localhost:27017: timed out (configured timeouts: timeoutMS: 500.0ms, connectTimeoutMS: 20000.0ms)
       [2024/10/12 06:59:14.255] pymongo/asynchronous/pool.py:200: NetworkTimeout
      

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            steve.silvester@mongodb.com Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: