@Hassan_Anwer, the approach you’ve taken to refresh credentials looks good, but the error you’re getting is about dead monitoring threads. This is typically seen when our guidance for usage with forking servers isn’t followed.
Updating your application server configuration to ensure Mongoid clients disconnect/reconnect on fork should prevent these issues from occurring.