Hello @Prasanna_Bale, welcome to the MongoDB community forums.
Based on the error message you provided, it appears that you might be encountering a similar issue to the one described in JAVA-2609: mongo throws IllegalStateException: state should be: open. The error could be caused by another process or thread closing the connection with your MongoDB client, which later results in an error when trying to connect again.
To resolve this issue, you may need to review your application’s code to determine when to keep the connection open and when to close the MongoClient connection. It is recommended to create a single MongoClient instance with a required connection pool and reuse it across multiple threads instead of creating a new MongoClient instance each time you need to access the MongoDB Server deployment.
I tried to replicate the error message by querying on MongoDb after the connection was closed and ran into the same error log It would be helpful if you could trace any changes made to the application code, such as the scope of the MongoClient. For instance, there could be a possible addition or removal of try{}… catch{} code snippet.
Please reach out to us for further questions.
Best regards,
Aasawari