-
Type: Build Failure
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Python Drivers
-
Not Needed
Name of Failure:
test.asynchronous.test_encryption.AsyncTestSpec.*
Link to task:
Context of when and why the failure occurred:
PYTHON-4700, only happens on Windows
Stack trace:
[2024/10/16 19:08:29.972] FAILURE: pymongo.errors.EncryptionError: kms.us-east-1.amazonaws.com:443: _async_receive_ssl() got an unexpected keyword argument 'once' () [2024/10/16 19:08:29.972] self = <pymongo.asynchronous.encryption._EncryptionIO object at 0x000001BA52E945E0> [2024/10/16 19:08:29.972] kms_context = <pymongocrypt.mongocrypt.MongoCryptKmsContext object at 0x000001BA547E56C0> [2024/10/16 19:08:29.972] async def kms_request(self, kms_context: MongoCryptKmsContext) -> None: [2024/10/16 19:08:29.972] """Complete a KMS request. [2024/10/16 19:08:29.972] [2024/10/16 19:08:29.972] :param kms_context: A :class:`MongoCryptKmsContext`. [2024/10/16 19:08:29.972] [2024/10/16 19:08:29.972] :return: None [2024/10/16 19:08:29.972] """ [2024/10/16 19:08:29.972] endpoint = kms_context.endpoint [2024/10/16 19:08:29.972] message = kms_context.message [2024/10/16 19:08:29.972] provider = kms_context.kms_provider [2024/10/16 19:08:29.972] ctx = self.opts._kms_ssl_contexts.get(provider) [2024/10/16 19:08:29.972] if ctx is None: [2024/10/16 19:08:29.972] # Enable strict certificate verification, OCSP, match hostname, and [2024/10/16 19:08:29.972] # SNI using the system default CA certificates. [2024/10/16 19:08:29.972] ctx = get_ssl_context( [2024/10/16 19:08:29.972] None, # certfile [2024/10/16 19:08:29.972] None, # passphrase [2024/10/16 19:08:29.972] None, # ca_certs [2024/10/16 19:08:29.972] None, # crlfile [2024/10/16 19:08:29.972] False, # allow_invalid_certificates [2024/10/16 19:08:29.972] False, # allow_invalid_hostnames [2024/10/16 19:08:29.972] False, [2024/10/16 19:08:29.972] ) # disable_ocsp_endpoint_check [2024/10/16 19:08:29.972] # CSOT: set timeout for socket creation. [2024/10/16 19:08:29.972] connect_timeout = max(_csot.clamp_remaining(_KMS_CONNECT_TIMEOUT), 0.001) [2024/10/16 19:08:29.972] opts = PoolOptions( [2024/10/16 19:08:29.972] connect_timeout=connect_timeout, [2024/10/16 19:08:29.972] socket_timeout=connect_timeout, [2024/10/16 19:08:29.972] ssl_context=ctx, [2024/10/16 19:08:29.972] ) [2024/10/16 19:08:29.972] host, port = parse_host(endpoint, _HTTPS_PORT) [2024/10/16 19:08:29.972] try: [2024/10/16 19:08:29.972] conn = await _configured_socket((host, port), opts) [2024/10/16 19:08:29.972] try: [2024/10/16 19:08:29.972] await async_sendall(conn, message) [2024/10/16 19:08:29.972] while kms_context.bytes_needed > 0: [2024/10/16 19:08:29.972] # CSOT: update timeout. [2024/10/16 19:08:29.972] conn.settimeout(max(_csot.clamp_remaining(_KMS_CONNECT_TIMEOUT), 0)) [2024/10/16 19:08:29.972] if _IS_SYNC: [2024/10/16 19:08:29.972] data = conn.recv(kms_context.bytes_needed) [2024/10/16 19:08:29.972] else: [2024/10/16 19:08:29.972] from pymongo.network_layer import ( # type: ignore[attr-defined] [2024/10/16 19:08:29.972] async_receive_data_socket, [2024/10/16 19:08:29.972] ) [2024/10/16 19:08:29.972] [2024/10/16 19:08:29.972] > data = await async_receive_data_socket(conn, kms_context.bytes_needed) [2024/10/16 19:08:29.972] pymongo\asynchronous\encryption.py:190: [2024/10/16 19:08:29.972] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [2024/10/16 19:08:29.972] sock = <ssl.SSLSocket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0> [2024/10/16 19:08:29.972] length = 1024 [2024/10/16 19:08:29.972] async def async_receive_data_socket( [2024/10/16 19:08:29.972] sock: Union[socket.socket, _sslConn], length: int [2024/10/16 19:08:29.972] ) -> memoryview: [2024/10/16 19:08:29.972] sock_timeout = sock.gettimeout() [2024/10/16 19:08:29.972] timeout = sock_timeout [2024/10/16 19:08:29.972] [2024/10/16 19:08:29.972] sock.settimeout(0.0) [2024/10/16 19:08:29.972] loop = asyncio.get_event_loop() [2024/10/16 19:08:29.972] try: [2024/10/16 19:08:29.972] if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)): [2024/10/16 19:08:29.972] return await asyncio.wait_for( [2024/10/16 19:08:29.972] > _async_receive_ssl(sock, length, loop, once=True), # type: ignore[arg-type] [2024/10/16 19:08:29.972] timeout=timeout, [2024/10/16 19:08:29.972] ) [2024/10/16 19:08:29.972] E TypeError: _async_receive_ssl() got an unexpected keyword argument 'once' [2024/10/16 19:08:29.972] pymongo\network_layer.py:292: TypeError [2024/10/16 19:08:29.972] The above exception was the direct cause of the following exception: [2024/10/16 19:08:29.972] @contextlib.contextmanager [2024/10/16 19:08:29.972] def _wrap_encryption_errors() -> Iterator[None]: [2024/10/16 19:08:29.972] """Context manager to wrap encryption related errors.""" [2024/10/16 19:08:29.972] try: [2024/10/16 19:08:29.972] > yield [2024/10/16 19:08:29.972] pymongo\asynchronous\encryption.py:109: [2024/10/16 19:08:29.972] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [2024/10/16 19:08:29.972] pymongo\asynchronous\encryption.py:426: in encrypt [2024/10/16 19:08:29.972] encrypted_cmd = await self._auto_encrypter.encrypt(database, encoded_cmd) [2024/10/16 19:08:29.972] C:\cygdrive\c\data\mci\4188daf1ef1f5333d2f7a59af53915c2\src\.hatch\data\env\virtual\pymongo\9crSMNP1\test\lib\site-packages\pymongocrypt\asynchronous\auto_encrypter.py:44: in encrypt [2024/10/16 19:08:29.972] return await run_state_machine(ctx, self.callback) [2024/10/16 19:08:29.972] C:\cygdrive\c\data\mci\4188daf1ef1f5333d2f7a59af53915c2\src\.hatch\data\env\virtual\pymongo\9crSMNP1\test\lib\site-packages\pymongocrypt\asynchronous\state_machine.py:143: in run_state_machine [2024/10/16 19:08:29.972] await callback.kms_request(kms_ctx) [2024/10/16 19:08:29.972] pymongo\asynchronous\encryption.py:205: in kms_request [2024/10/16 19:08:29.972] _raise_connection_failure((host, port), error) [2024/10/16 19:08:29.972] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [2024/10/16 19:08:29.972] address = ('kms.us-east-1.amazonaws.com', 443) [2024/10/16 19:08:29.972] error = TypeError("_async_receive_ssl() got an unexpected keyword argument 'once'") [2024/10/16 19:08:29.972] msg_prefix = None, timeout_details = None [2024/10/16 19:08:29.972] def _raise_connection_failure( [2024/10/16 19:08:29.972] address: Any, [2024/10/16 19:08:29.972] error: Exception, [2024/10/16 19:08:29.972] msg_prefix: Optional[str] = None, [2024/10/16 19:08:29.972] timeout_details: Optional[dict[str, float]] = None, [2024/10/16 19:08:29.972] ) -> NoReturn: [2024/10/16 19:08:29.972] """Convert a socket.error to ConnectionFailure and raise it.""" [2024/10/16 19:08:29.972] host, port = address [2024/10/16 19:08:29.972] # If connecting to a Unix socket, port will be None. [2024/10/16 19:08:29.972] if port is not None: [2024/10/16 19:08:29.972] msg = "%s:%d: %s" % (host, port, error) [2024/10/16 19:08:29.972] else: [2024/10/16 19:08:29.972] msg = f"{host}: {error}" [2024/10/16 19:08:29.972] if msg_prefix: [2024/10/16 19:08:29.972] msg = msg_prefix + msg [2024/10/16 19:08:29.972] if "configured timeouts" not in msg: [2024/10/16 19:08:29.972] msg += format_timeout_details(timeout_details) [2024/10/16 19:08:29.972] if isinstance(error, socket.timeout): [2024/10/16 19:08:29.972] raise NetworkTimeout(msg) from error [2024/10/16 19:08:29.972] elif isinstance(error, SSLError) and "timed out" in str(error): [2024/10/16 19:08:29.972] # Eventlet does not distinguish TLS network timeouts from other [2024/10/16 19:08:29.972] # SSLErrors (https://github.com/eventlet/eventlet/issues/692). [2024/10/16 19:08:29.972] # Luckily, we can work around this limitation because the phrase [2024/10/16 19:08:29.972] # 'timed out' appears in all the timeout related SSLErrors raised. [2024/10/16 19:08:29.972] raise NetworkTimeout(msg) from error [2024/10/16 19:08:29.972] else: [2024/10/16 19:08:29.972] > raise AutoReconnect(msg) from error [2024/10/16 19:08:29.972] E pymongo.errors.AutoReconnect: kms.us-east-1.amazonaws.com:443: _async_receive_ssl() got an unexpected keyword argument 'once' [2024/10/16 19:08:29.972] pymongo\asynchronous\pool.py:208: AutoReconnect [2024/10/16 19:08:29.972] The above exception was the direct cause of the following exception: [2024/10/16 19:08:29.972] self = <test.asynchronous.test_encryption.AsyncTestSpec testMethod=test_legacy_awsTemporary_Insert_a_document_with_auto_encryption_using_the_AWS_provider_with_temporary_credentials> [2024/10/16 19:08:29.972] @async_client_context.require_test_commands [2024/10/16 19:08:29.972] async def run_scenario(self): [2024/10/16 19:08:29.972] > await self.run_scenario(scenario_def, test) [2024/10/16 19:08:29.972] test\asynchronous\test_encryption.py:740: [2024/10/16 19:08:29.972] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [2024/10/16 19:08:29.972] test\asynchronous\utils_spec_runner.py:729: in run_scenario [2024/10/16 19:08:29.972] await self.run_test_ops(sessions, collection, test) [2024/10/16 19:08:29.972] test\asynchronous\utils_spec_runner.py:627: in run_test_ops [2024/10/16 19:08:29.972] await self.run_operations(sessions, collection, test["operations"]) [2024/10/16 19:08:29.972] test\asynchronous\utils_spec_runner.py:541: in run_operations [2024/10/16 19:08:29.972] await self._run_op(sessions, collection, op, in_with_transaction) [2024/10/16 19:08:29.972] test\asynchronous\utils_spec_runner.py:532: in _run_op [2024/10/16 19:08:29.972] result = await self.run_operation(sessions, collection, op.copy()) [2024/10/16 19:08:29.972] test\asynchronous\utils_spec_runner.py:477: in run_operation [2024/10/16 19:08:29.972] result = await cmd(**dict(arguments)) [2024/10/16 19:08:29.972] pymongo\asynchronous\collection.py:892: in insert_one [2024/10/16 19:08:29.972] await self._insert_one( [2024/10/16 19:08:29.972] pymongo\asynchronous\collection.py:832: in _insert_one [2024/10/16 19:08:29.972] await self._database.client._retryable_write( [2024/10/16 19:08:29.972] pymongo\asynchronous\mongo_client.py:1896: in _retryable_write [2024/10/16 19:08:29.972] return await self._retry_with_session(retryable, func, s, bulk, operation, operation_id) [2024/10/16 19:08:29.972] pymongo\asynchronous\mongo_client.py:1782: in _retry_with_session [2024/10/16 19:08:29.972] return await self._retry_internal( [2024/10/16 19:08:29.972] pymongo\_csot.py:109: in csot_wrapper [2024/10/16 19:08:29.972] return await func(self, *args, **kwargs) [2024/10/16 19:08:29.972] pymongo\asynchronous\mongo_client.py:1817: in _retry_internal [2024/10/16 19:08:29.972] return await _ClientConnectionRetryable( [2024/10/16 19:08:29.972] pymongo\asynchronous\mongo_client.py:2560: in run [2024/10/16 19:08:29.972] return await self._read() if self._is_read else await self._write() [2024/10/16 19:08:29.972] pymongo\asynchronous\mongo_client.py:2682: in _write [2024/10/16 19:08:29.972] return await self._func(self._session, conn, self._retryable) # type: ignore [2024/10/16 19:08:29.972] pymongo\asynchronous\collection.py:820: in _insert_command [2024/10/16 19:08:29.972] result = await conn.command( [2024/10/16 19:08:29.972] pymongo\asynchronous\helpers.py:45: in inner [2024/10/16 19:08:29.972] return await func(*args, **kwargs) [2024/10/16 19:08:29.972] pymongo\asynchronous\pool.py:566: in command [2024/10/16 19:08:29.972] self._raise_connection_failure(error) [2024/10/16 19:08:29.972] pymongo\asynchronous\pool.py:538: in command [2024/10/16 19:08:29.972] return await command( [2024/10/16 19:08:29.972] pymongo\asynchronous\network.py:143: in command [2024/10/16 19:08:29.972] spec = orig = await client._encrypter.encrypt(dbname, spec, codec_options) [2024/10/16 19:08:29.972] pymongo\asynchronous\encryption.py:425: in encrypt [2024/10/16 19:08:29.972] with _wrap_encryption_errors(): [2024/10/16 19:08:29.972] C:\python\Python310\lib\contextlib.py:153: in __exit__ [2024/10/16 19:08:29.972] self.gen.throw(typ, value, traceback) [2024/10/16 19:08:29.972] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [2024/10/16 19:08:29.972] @contextlib.contextmanager [2024/10/16 19:08:29.972] def _wrap_encryption_errors() -> Iterator[None]: [2024/10/16 19:08:29.972] """Context manager to wrap encryption related errors.""" [2024/10/16 19:08:29.972] try: [2024/10/16 19:08:29.972] yield [2024/10/16 19:08:29.972] except BSONError: [2024/10/16 19:08:29.972] # BSON encoding/decoding errors are unrelated to encryption so [2024/10/16 19:08:29.972] # we should propagate them unchanged. [2024/10/16 19:08:29.972] raise [2024/10/16 19:08:29.972] except Exception as exc: [2024/10/16 19:08:29.972] > raise EncryptionError(exc) from exc [2024/10/16 19:08:29.972] E pymongo.errors.EncryptionError: kms.us-east-1.amazonaws.com:443: _async_receive_ssl() got an unexpected keyword argument 'once' [2024/10/16 19:08:29.972] pymongo\asynchronous\encryption.py:115: EncryptionError