Testing latest server release, we are hitting an unexpected invariant:
It's happening due to a combination of factors:
- We are testing against a server with requireApiVersion parameter set to true, which causes the isMaster handshake command to fail.
- For unrelated reasons, we are using a version of PyMongo with a bug that exposes the invariant (
PYTHON-1434) by retrying the ismaster on the same connection. It will be difficult to upgrade PyMongo in the short term.
What we expect to happen is that the server uasserts and perhaps closes the connection. What actually happens is that we hit the invariant and the server shuts down.
This behavior seems to have been introduced relatively recently, in scope of
SERVER-49336. I discussed it briefly with the author of that commit, and it doesn't appear that this behavior is intended. Instead, we should first be hitting this uassert, but it seems that we are not.
Server logs are available here.