I am using MongoDB Sharded Cluster architecture to store my datas safely and efficiently, but when I check my mongos (or mongoRouter) logs, in daily bases I have been getting this error on different times for each shards, config server and mongos regularly: {"t":{"$date":"2022-02-28T15:59:38.533+03:00"},"s":"I", "c":"CONNPOOL", "id":22572, "ctx":"establishCursors cleanup","msg":"Dropping all pooled connections","attr":{"hostAndPort":"server1:27019","error":"ShutdownInProgress: Pool for server1:27019 has expired."}} • Following figure shows my sharded cluster set-up (server1, server2 and server3 represent different servers) • Following code block shows the client connection that I use to connect MongoDB in Python3. (I refresh the connection every 5 hours, that's why I use "five_hours_added_time" variable.) class MongoRouterClient: __instance = None __connection_uptime = None @staticmethod def get_instance(): if MongoRouterClient.__instance is None: MongoRouterClient() elif (MongoRouterClient.__connection_uptime + five_hours_added_time) < datetime.datetime.now(): MongoRouterClient.__instance.close() MongoRouterClient.__instance = pymongo.MongoClient( f"mongodb://{MONGOROUTER1_URL},{MONGOROUTER2_URL},{MONGOROUTER3_URL}", connect=False, serverSelectionTimeoutMS=2000, readPreference='secondaryPreferred') MongoRouterClient.__connection_uptime = datetime.datetime.now() return MongoRouterClient.__instance return MongoRouterClient.__instance def __init__(self): """ Virtually private constructor. """ if MongoRouterClient.__instance is not None: raise Exception("This class is a singleton!") else: MongoRouterClient.__instance = pymongo.MongoClient( f"mongodb://{MONGOROUTER1_URL},{MONGOROUTER2_URL},{MONGOROUTER3_URL}", connect=False, serverSelectionTimeoutMS=2000, readPreference='secondaryPreferred') MongoRouterClient.__connection_uptime = datetime.datetime.now() Does anyone know what is the reason of getting this error and what to do for solving it? Continue reading...