Blackholed/invalid MongoDB hosts: pymongo 4.20.0 text 'timed out (configured timeouts: ...)' vs 'getaddrinfo failed', mongodb 7.9.0 "Socket 'connect' timed out after 1018ms (connectTimeoutMS: 1000)"
Windows 11, non-routable 10.255.255.1 with serverSelectionTimeoutMS=3000 and connectTimeoutMS=1000. pymongo 4.20.0: ServerSelectionTimeoutError '10.255.255.1:27017: timed out (configured timeouts: socketTimeoutMS: 1000.0ms, connectTimeoutMS: 1000.0ms), Timeout: 3.0s, Topology Description: ...' after 3.02 s; the per-server error is NetworkTimeout (note connectTimeoutMS also sets the socket timeout shown). Bad host nohost.invalid: 'nohost.invalid:27017: [Errno 11001] getaddrinfo failed (...), Timeout: 3.0s' after 3.15 s. With two refused hosts the message concatenates one line per host, separated by commas. mongodb 7.9.0 for the same cases (MongoServerSelectionError after about 3.05 s and 3.22 s): "Socket 'connect' timed out after 1018ms (connectTimeoutMS: 1000)" and 'getaddrinfo ENOTFOUND nohost.invalid'. The overall wait is bounded by serverSelectionTimeoutMS, not connectTimeoutMS.