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

test.test_transactions_unified.TestUnifiedErrorLabelsBlockConnection.test_add_RetryableWriteError_and_UnknownTransactionCommitResult_labels_to_connection_errors

    • Type: Icon: Build Failure Build Failure
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: 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?

      Name of Failure:

      test.test_transactions_unified.TestUnifiedErrorLabelsBlockConnection.test_add_RetryableWriteError_and_UnknownTransactionCommitResult_labels_to_connection_errors

      Link to task:

      https://spruce.mongodb.com/task/mongo_python_driver_test_macos_python3.13_test_8.0_replica_set_noauth_ssl_sync_1c7a7fe9ec3119228bc7bf98f1f9de199a4f8f2c_24_11_20_19_47_28/tests?execution=0&sortBy=STATUS&sortDir=ASC

      Context of when and why the failure occurred:

      FAILURE: pymongo.errors.NetworkTimeout: localhost:27017: timed out (configured timeouts: socketTimeoutMS: 100.0ms, connectTimeoutMS: 20000.0ms) ()

      Stack trace:

      https://evergreen.mongodb.com/test_log/mongo_python_driver_test_macos_python3.13_test_8.0_replica_set_noauth_ssl_sync_1c7a7fe9ec3119228bc7bf98f1f9de199a4f8f2c_24_11_20_19_47_28/0?test_name=2411d49f253b9ea41dcfbebd7f4d0e72#L0

       

      [2024/11/21 07:03:14.383] FAILURE: pymongo.errors.NetworkTimeout: localhost:27017: timed out (configured timeouts: socketTimeoutMS: 100.0ms, connectTimeoutMS: 20000.0ms) ()
      [2024/11/21 07:03:14.383] self = Connection(<ssl.SSLSocket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>) CLOSED at 4494285488
      [2024/11/21 07:03:14.383] dbname = 'admin'
      [2024/11/21 07:03:14.383] spec = {'$clusterTime': {'clusterTime': Timestamp(1732190468, 4), 'signature': {'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x0...eFailPoint': 'failCommand', 'lsid': {'id': Binary(b'\xf3\xe5%\x90x\xa9B\x9d\x86\xf5\x95\x87\x06\x81\xad\xf9', 4)}, ...}
      [2024/11/21 07:03:14.383] read_preference = Primary()
      [2024/11/21 07:03:14.383] codec_options = CodecOptions(document_class=dict, tz_aware=False, uuid_representation=UuidRepresentation.UNSPECIFIED, unicode_decode_e...ne, type_registry=TypeRegistry(type_codecs=[], fallback_encoder=None), datetime_conversion=DatetimeConversion.DATETIME)
      [2024/11/21 07:03:14.383] check = True, allowable_errors = None, read_concern = None, write_concern = None
      [2024/11/21 07:03:14.383] parse_write_concern_error = False, collation = None
      [2024/11/21 07:03:14.383] session = <pymongo.synchronous.client_session.ClientSession object at 0x10be177c0>
      [2024/11/21 07:03:14.383] client = MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True, tls=True, tlscertificatekeyfi...t='repl0', event_listeners=[<test.unified_format_shared.EventListenerUtil object at 0x10e61a0b0>], sockettimeoutms=100)
      [2024/11/21 07:03:14.383] retryable_write = False, publish_events = True, user_fields = None
      [2024/11/21 07:03:14.383] exhaust_allowed = False
      [2024/11/21 07:03:14.383]     @_handle_reauth
      [2024/11/21 07:03:14.383]     def command(
      [2024/11/21 07:03:14.383]         self,
      [2024/11/21 07:03:14.383]         dbname: str,
      [2024/11/21 07:03:14.383]         spec: MutableMapping[str, Any],
      [2024/11/21 07:03:14.383]         read_preference: _ServerMode = ReadPreference.PRIMARY,
      [2024/11/21 07:03:14.383]         codec_options: CodecOptions = DEFAULT_CODEC_OPTIONS,
      [2024/11/21 07:03:14.383]         check: bool = True,
      [2024/11/21 07:03:14.383]         allowable_errors: Optional[Sequence[Union[str, int]]] = None,
      [2024/11/21 07:03:14.383]         read_concern: Optional[ReadConcern] = None,
      [2024/11/21 07:03:14.383]         write_concern: Optional[WriteConcern] = None,
      [2024/11/21 07:03:14.383]         parse_write_concern_error: bool = False,
      [2024/11/21 07:03:14.383]         collation: Optional[_CollationIn] = None,
      [2024/11/21 07:03:14.383]         session: Optional[ClientSession] = None,
      [2024/11/21 07:03:14.383]         client: Optional[MongoClient] = None,
      [2024/11/21 07:03:14.383]         retryable_write: bool = False,
      [2024/11/21 07:03:14.383]         publish_events: bool = True,
      [2024/11/21 07:03:14.383]         user_fields: Optional[Mapping[str, Any]] = None,
      [2024/11/21 07:03:14.383]         exhaust_allowed: bool = False,
      [2024/11/21 07:03:14.383]     ) -> dict[str, Any]:
      [2024/11/21 07:03:14.383]         """Execute a command or raise an error.
      [2024/11/21 07:03:14.383]     
      [2024/11/21 07:03:14.383]         :param dbname: name of the database on which to run the command
      [2024/11/21 07:03:14.383]         :param spec: a command document as a dict, SON, or mapping object
      [2024/11/21 07:03:14.383]         :param read_preference: a read preference
      [2024/11/21 07:03:14.383]         :param codec_options: a CodecOptions instance
      [2024/11/21 07:03:14.383]         :param check: raise OperationFailure if there are errors
      [2024/11/21 07:03:14.383]         :param allowable_errors: errors to ignore if `check` is True
      [2024/11/21 07:03:14.383]         :param read_concern: The read concern for this command.
      [2024/11/21 07:03:14.383]         :param write_concern: The write concern for this command.
      [2024/11/21 07:03:14.383]         :param parse_write_concern_error: Whether to parse the
      [2024/11/21 07:03:14.383]             ``writeConcernError`` field in the command response.
      [2024/11/21 07:03:14.383]         :param collation: The collation for this command.
      [2024/11/21 07:03:14.383]         :param session: optional ClientSession instance.
      [2024/11/21 07:03:14.383]         :param client: optional MongoClient for gossipping $clusterTime.
      [2024/11/21 07:03:14.383]         :param retryable_write: True if this command is a retryable write.
      [2024/11/21 07:03:14.383]         :param publish_events: Should we publish events for this command?
      [2024/11/21 07:03:14.383]         :param user_fields: Response fields that should be decoded
      [2024/11/21 07:03:14.383]             using the TypeDecoders from codec_options, passed to
      [2024/11/21 07:03:14.383]             bson._decode_all_selective.
      [2024/11/21 07:03:14.383]         """
      [2024/11/21 07:03:14.383]         self.validate_session(client, session)
      [2024/11/21 07:03:14.383]         session = _validate_session_write_concern(session, write_concern)
      [2024/11/21 07:03:14.383]     
      [2024/11/21 07:03:14.383]         # Ensure command name remains in first place.
      [2024/11/21 07:03:14.383]         if not isinstance(spec, ORDERED_TYPES):  # type:ignore[arg-type]
      [2024/11/21 07:03:14.383]             spec = dict(spec)
      [2024/11/21 07:03:14.383]     
      [2024/11/21 07:03:14.383]         if not (write_concern is None or write_concern.acknowledged or collation is None):
      [2024/11/21 07:03:14.383]             raise ConfigurationError("Collation is unsupported for unacknowledged writes.")
      [2024/11/21 07:03:14.383]     
      [2024/11/21 07:03:14.383]         self.add_server_api(spec)
      [2024/11/21 07:03:14.383]         if session:
      [2024/11/21 07:03:14.383]             session._apply_to(spec, retryable_write, read_preference, self)
      [2024/11/21 07:03:14.383]         self.send_cluster_time(spec, session, client)
      [2024/11/21 07:03:14.383]         listeners = self.listeners if publish_events else None
      [2024/11/21 07:03:14.383]         unacknowledged = bool(write_concern and not write_concern.acknowledged)
      [2024/11/21 07:03:14.383]         if self.op_msg_enabled:
      [2024/11/21 07:03:14.383]             self._raise_if_not_writable(unacknowledged)
      [2024/11/21 07:03:14.383]         try:
      [2024/11/21 07:03:14.383] >           return command(
      [2024/11/21 07:03:14.383]                 self,
      [2024/11/21 07:03:14.383]                 dbname,
      [2024/11/21 07:03:14.383]                 spec,
      [2024/11/21 07:03:14.383]                 self.is_mongos,
      [2024/11/21 07:03:14.383]                 read_preference,
      [2024/11/21 07:03:14.383]                 codec_options,
      [2024/11/21 07:03:14.383]                 session,
      [2024/11/21 07:03:14.383]                 client,
      [2024/11/21 07:03:14.383]                 check,
      [2024/11/21 07:03:14.383]                 allowable_errors,
      [2024/11/21 07:03:14.383]                 self.address,
      [2024/11/21 07:03:14.383]                 listeners,
      [2024/11/21 07:03:14.383]                 self.max_bson_size,
      [2024/11/21 07:03:14.383]                 read_concern,
      [2024/11/21 07:03:14.383]                 parse_write_concern_error=parse_write_concern_error,
      [2024/11/21 07:03:14.383]                 collation=collation,
      [2024/11/21 07:03:14.383]                 compression_ctx=self.compression_context,
      [2024/11/21 07:03:14.383]                 use_op_msg=self.op_msg_enabled,
      [2024/11/21 07:03:14.383]                 unacknowledged=unacknowledged,
      [2024/11/21 07:03:14.383]                 user_fields=user_fields,
      [2024/11/21 07:03:14.383]                 exhaust_allowed=exhaust_allowed,
      [2024/11/21 07:03:14.383]                 write_concern=write_concern,
      [2024/11/21 07:03:14.383]             )
      [2024/11/21 07:03:14.383] pymongo/synchronous/pool.py:538: 
      [2024/11/21 07:03:14.383] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      [2024/11/21 07:03:14.383] pymongo/synchronous/network.py:203: in command
      [2024/11/21 07:03:14.383]     reply = receive_message(conn, request_id)
      [2024/11/21 07:03:14.383] pymongo/synchronous/network.py:315: in receive_message
      [2024/11/21 07:03:14.383]     length, _, response_to, op_code = _UNPACK_HEADER(receive_data(conn, 16, deadline))
      [2024/11/21 07:03:14.383] pymongo/network_layer.py:357: in receive_data
      [2024/11/21 07:03:14.383]     wait_for_read(conn, deadline)
      [2024/11/21 07:03:14.383] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      [2024/11/21 07:03:14.383] conn = Connection(<ssl.SSLSocket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>) CLOSED at 4494285488
      [2024/11/21 07:03:14.383] deadline = 18485.465187578
      [2024/11/21 07:03:14.383]     def wait_for_read(conn: Connection, deadline: Optional[float]) -> None:
      [2024/11/21 07:03:14.383]         """Block until at least one byte is read, or a timeout, or a cancel."""
      [2024/11/21 07:03:14.383]         sock = conn.conn
      [2024/11/21 07:03:14.383]         timed_out = False
      [2024/11/21 07:03:14.383]         # Check if the connection's socket has been manually closed
      [2024/11/21 07:03:14.383]         if sock.fileno() == -1:
      [2024/11/21 07:03:14.383]             return
      [2024/11/21 07:03:14.383]         while True:
      [2024/11/21 07:03:14.383]             # SSLSocket can have buffered data which won't be caught by select.
      [2024/11/21 07:03:14.383]             if hasattr(sock, "pending") and sock.pending() > 0:
      [2024/11/21 07:03:14.383]                 readable = True
      [2024/11/21 07:03:14.383]             else:
      [2024/11/21 07:03:14.383]                 # Wait up to 500ms for the socket to become readable and then
      [2024/11/21 07:03:14.383]                 # check for cancellation.
      [2024/11/21 07:03:14.383]                 if deadline:
      [2024/11/21 07:03:14.383]                     remaining = deadline - time.monotonic()
      [2024/11/21 07:03:14.383]                     # When the timeout has expired perform one final check to
      [2024/11/21 07:03:14.383]                     # see if the socket is readable. This helps avoid spurious
      [2024/11/21 07:03:14.383]                     # timeouts on AWS Lambda and other FaaS environments.
      [2024/11/21 07:03:14.383]                     if remaining <= 0:
      [2024/11/21 07:03:14.383]                         timed_out = True
      [2024/11/21 07:03:14.383]                     timeout = max(min(remaining, _POLL_TIMEOUT), 0)
      [2024/11/21 07:03:14.383]                 else:
      [2024/11/21 07:03:14.383]                     timeout = _POLL_TIMEOUT
      [2024/11/21 07:03:14.383]                 readable = conn.socket_checker.select(sock, read=True, timeout=timeout)
      [2024/11/21 07:03:14.383]             if conn.cancel_context.cancelled:
      [2024/11/21 07:03:14.383]                 raise _OperationCancelled("operation cancelled")
      [2024/11/21 07:03:14.383]             if readable:
      [2024/11/21 07:03:14.383]                 return
      [2024/11/21 07:03:14.383]             if timed_out:
      [2024/11/21 07:03:14.383] >               raise socket.timeout("timed out")
      [2024/11/21 07:03:14.383] E               TimeoutError: timed out
      [2024/11/21 07:03:14.383] pymongo/network_layer.py:348: TimeoutError
      [2024/11/21 07:03:14.383] The above exception was the direct cause of the following exception:
      [2024/11/21 07:03:14.383] pymongo/_csot.py:119: in csot_wrapper
      [2024/11/21 07:03:14.383]     return func(self, *args, **kwargs)
      [2024/11/21 07:03:14.383] pymongo/synchronous/database.py:930: in command
      [2024/11/21 07:03:14.383]     return self._command(
      [2024/11/21 07:03:14.383] pymongo/synchronous/database.py:770: in _command
      [2024/11/21 07:03:14.383]     return conn.command(
      [2024/11/21 07:03:14.383] pymongo/synchronous/helpers.py:45: in inner
      [2024/11/21 07:03:14.383]     return func(*args, **kwargs)
      [2024/11/21 07:03:14.383] pymongo/synchronous/pool.py:566: in command
      [2024/11/21 07:03:14.383]     self._raise_connection_failure(error)
      [2024/11/21 07:03:14.383] pymongo/synchronous/pool.py:763: in _raise_connection_failure
      [2024/11/21 07:03:14.383]     _raise_connection_failure(self.address, error, timeout_details=details)
      [2024/11/21 07:03:14.383] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      [2024/11/21 07:03:14.383] address = ('localhost', 27017), error = TimeoutError('timed out')
      [2024/11/21 07:03:14.383] msg_prefix = None
      [2024/11/21 07:03:14.383] timeout_details = {'connectTimeoutMS': 20000.0, 'socketTimeoutMS': 100.0}
      [2024/11/21 07:03:14.383]     def _raise_connection_failure(
      [2024/11/21 07:03:14.383]         address: Any,
      [2024/11/21 07:03:14.383]         error: Exception,
      [2024/11/21 07:03:14.383]         msg_prefix: Optional[str] = None,
      [2024/11/21 07:03:14.383]         timeout_details: Optional[dict[str, float]] = None,
      [2024/11/21 07:03:14.383]     ) -> NoReturn:
      [2024/11/21 07:03:14.383]         """Convert a socket.error to ConnectionFailure and raise it."""
      [2024/11/21 07:03:14.383]         host, port = address
      [2024/11/21 07:03:14.383]         # If connecting to a Unix socket, port will be None.
      [2024/11/21 07:03:14.383]         if port is not None:
      [2024/11/21 07:03:14.383]             msg = "%s:%d: %s" % (host, port, error)
      [2024/11/21 07:03:14.383]         else:
      [2024/11/21 07:03:14.383]             msg = f"{host}: {error}"
      [2024/11/21 07:03:14.383]         if msg_prefix:
      [2024/11/21 07:03:14.383]             msg = msg_prefix + msg
      [2024/11/21 07:03:14.383]         if "configured timeouts" not in msg:
      [2024/11/21 07:03:14.383]             msg += format_timeout_details(timeout_details)
      [2024/11/21 07:03:14.383]         if isinstance(error, socket.timeout):
      [2024/11/21 07:03:14.383] >           raise NetworkTimeout(msg) from error
      [2024/11/21 07:03:14.383] E           pymongo.errors.NetworkTimeout: localhost:27017: timed out (configured timeouts: socketTimeoutMS: 100.0ms, connectTimeoutMS: 20000.0ms)
      [2024/11/21 07:03:14.383] pymongo/synchronous/pool.py:200: NetworkTimeout 

            Assignee:
            Unassigned Unassigned
            Reporter:
            jib.adegunloye@mongodb.com Jib Adegunloye
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: