-
Type:
Build Failure
-
Resolution: Fixed
-
Priority:
Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Python Drivers
-
Not Needed
-
-
None
-
None
-
None
-
None
-
None
-
None
Name of Failure:
pymongo.errors.ServerSelectionTimeoutError: SSL handshake failed: localhost:27017: [('SSL routines', '', 'invalid status response')]
Link to task:
Context of when and why the failure occurred:
PYTHON-5195. The OSCP server MUST be started before the MongoDB server.
Stack trace:
[2025/04/01 16:33:10.303] FAILURE: pymongo.errors.ServerSelectionTimeoutError: SSL handshake failed: localhost:27017: [('SSL routines', '', 'invalid status response')] (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms), Timeout: 0.5s, Topology Description: <TopologyDescription id: 67ec5b90296f5d70668cd2e3, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect("SSL handshake failed: localhost:27017: [('SSL routines', '', 'invalid status response')] (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)")>]> () [2025/04/01 16:33:10.303] self = <test_ocsp.TestOCSP testMethod=test_tls> [2025/04/01 16:33:10.303] def test_tls(self): [2025/04/01 16:33:10.303] options = "tls=true" [2025/04/01 16:33:10.303] if not OCSP_TLS_SHOULD_SUCCEED: [2025/04/01 16:33:10.303] self.assertRaisesRegex( [2025/04/01 16:33:10.303] ServerSelectionTimeoutError, "invalid status response", _connect, options [2025/04/01 16:33:10.303] ) [2025/04/01 16:33:10.303] else: [2025/04/01 16:33:10.303] > _connect(options) [2025/04/01 16:33:10.303] test/ocsp/test_ocsp.py:76: [2025/04/01 16:33:10.303] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [2025/04/01 16:33:10.303] test/ocsp/test_ocsp.py:53: in _connect [2025/04/01 16:33:10.303] client.admin.command("ping") [2025/04/01 16:33:10.303] pymongo/_csot.py:119: in csot_wrapper [2025/04/01 16:33:10.303] return func(self, *args, **kwargs) [2025/04/01 16:33:10.303] pymongo/synchronous/database.py:926: in command [2025/04/01 16:33:10.303] with self._client._conn_for_reads(read_preference, session, operation=command_name) as ( [2025/04/01 16:33:10.303] pymongo/synchronous/mongo_client.py:1829: in _conn_for_reads [2025/04/01 16:33:10.303] server = self._select_server(read_preference, session, operation) [2025/04/01 16:33:10.303] pymongo/synchronous/mongo_client.py:1777: in _select_server [2025/04/01 16:33:10.303] server = topology.select_server( [2025/04/01 16:33:10.303] pymongo/synchronous/topology.py:411: in select_server [2025/04/01 16:33:10.303] server = self._select_server( [2025/04/01 16:33:10.303] pymongo/synchronous/topology.py:389: in _select_server [2025/04/01 16:33:10.303] servers = self.select_servers( [2025/04/01 16:33:10.303] pymongo/synchronous/topology.py:296: in select_servers [2025/04/01 16:33:10.303] server_descriptions = self._select_servers_loop( [2025/04/01 16:33:10.303] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ [2025/04/01 16:33:10.303] self = <Topology CLOSED <TopologyDescription id: 67ec5b90296f5d70668cd2e3, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None>]>> [2025/04/01 16:33:10.303] selector = Primary(), timeout = 0.5, operation = 'ping', operation_id = None [2025/04/01 16:33:10.303] address = None [2025/04/01 16:33:10.303] def _select_servers_loop( [2025/04/01 16:33:10.303] self, [2025/04/01 16:33:10.303] selector: Callable[[Selection], Selection], [2025/04/01 16:33:10.303] timeout: float, [2025/04/01 16:33:10.303] operation: str, [2025/04/01 16:33:10.303] operation_id: Optional[int], [2025/04/01 16:33:10.303] address: Optional[_Address], [2025/04/01 16:33:10.303] ) -> list[ServerDescription]: [2025/04/01 16:33:10.303] """select_servers() guts. Hold the lock when calling this.""" [2025/04/01 16:33:10.303] now = time.monotonic() [2025/04/01 16:33:10.303] end_time = now + timeout [2025/04/01 16:33:10.303] logged_waiting = False [2025/04/01 16:33:10.303] [2025/04/01 16:33:10.303] if _SERVER_SELECTION_LOGGER.isEnabledFor(logging.DEBUG): [2025/04/01 16:33:10.303] _debug_log( [2025/04/01 16:33:10.303] _SERVER_SELECTION_LOGGER, [2025/04/01 16:33:10.303] message=_ServerSelectionStatusMessage.STARTED, [2025/04/01 16:33:10.303] selector=selector, [2025/04/01 16:33:10.303] operation=operation, [2025/04/01 16:33:10.303] operationId=operation_id, [2025/04/01 16:33:10.303] topologyDescription=self.description, [2025/04/01 16:33:10.303] clientId=self.description._topology_settings._topology_id, [2025/04/01 16:33:10.303] ) [2025/04/01 16:33:10.303] [2025/04/01 16:33:10.303] server_descriptions = self._description.apply_selector( [2025/04/01 16:33:10.303] selector, address, custom_selector=self._settings.server_selector [2025/04/01 16:33:10.303] ) [2025/04/01 16:33:10.303] [2025/04/01 16:33:10.303] while not server_descriptions: [2025/04/01 16:33:10.303] # No suitable servers. [2025/04/01 16:33:10.303] if timeout == 0 or now > end_time: [2025/04/01 16:33:10.303] if _SERVER_SELECTION_LOGGER.isEnabledFor(logging.DEBUG): [2025/04/01 16:33:10.303] _debug_log( [2025/04/01 16:33:10.303] _SERVER_SELECTION_LOGGER, [2025/04/01 16:33:10.303] message=_ServerSelectionStatusMessage.FAILED, [2025/04/01 16:33:10.303] selector=selector, [2025/04/01 16:33:10.303] operation=operation, [2025/04/01 16:33:10.303] operationId=operation_id, [2025/04/01 16:33:10.303] topologyDescription=self.description, [2025/04/01 16:33:10.303] clientId=self.description._topology_settings._topology_id, [2025/04/01 16:33:10.303] failure=self._error_message(selector), [2025/04/01 16:33:10.303] ) [2025/04/01 16:33:10.303] > raise ServerSelectionTimeoutError( [2025/04/01 16:33:10.303] f"{self._error_message(selector)}, Timeout: {timeout}s, Topology Description: {self.description!r}" [2025/04/01 16:33:10.303] ) [2025/04/01 16:33:10.303] E pymongo.errors.ServerSelectionTimeoutError: SSL handshake failed: localhost:27017: [('SSL routines', '', 'invalid status response')] (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms), Timeout: 0.5s, Topology Description: <TopologyDescription id: 67ec5b90296f5d70668cd2e3, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect("SSL handshake failed: localhost:27017: [('SSL routines', '', 'invalid status response')] (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)")>]> [2025/04/01 16:33:10.303] pymongo/synchronous/topology.py:346: ServerSelectionTimeoutError