It seems that at some point mongo db operations freezes. Even though that particular operation including ping command never responds the very next operation may be success.
We are using pymongo version 3.10. We are facing the same issue in pymongo version 3.9 also.
We are only facing this intermittent issue in aws.