StaleConfig - How to stop this

Hello,

We recived the below error, and all mongos stopped its connections.

“received StaleShardVersion error :: caused by :: StaleConfig”
I found this document, where it says this occurs if all the mongos not get updated?

Can anyone please help to understand this in detail.

Hi @Aayushi_Mangal!

Happy New Year!

Can you add some more context? What is your MongoDB version? Does the error occur while doing inserts, updates, or queries?

All the best,

– Rodrigo

Hi Rodrigo,
Happy New Year!

Version using 4.2.8

Our all mongos suddenly stopped working, unable to connect and we were receiving constantly these messages:
NETWORK [conn1524750] DBException handling request, closing client connection: ClientDisconnect: operation was interrupted.

and
SHARDING [PeriodicShardedIndexConsistencyChecker] Attempt 0 to check index consistency for DBname.Collname received StaleShardVersion error :: caused by :: StaleConfig

We logged these jira, but we are not sure if this is required flushrouter config or some hmac key refresh issue.
https://jira.mongodb.org/browse/SERVER-53540

So after some digging, I found these articles that stated flush required, because sometime metadata did not get updated across all the cluster.

But we did not have any of the drop database and other conditions except getShardDistribution commands.