The command in mongos kills all sessions and then sends the same killAllSessions to all shards. If the matcher is empty and the killAllSessions command has a lsid field, it will also end up calling killOp on itself since it is technically using a session. The remote killAllSessions call to every shard will still succeed since it is using a different operation context than the original command, but the original command will get interrupted early and will not wait for the remote commands to finish.
This is kind of problematic for drivers (and mongo shell) since every request is using an implicit session. As a result, there is currently no reliable way to synchronously block and wait for killAllSessions to complete before proceeding.
- is related to
-
SERVER-44096 killAllSessionsByPattern can kill itself if the pattern matches current session
- Closed
- related to
-
SERVER-78647 Remove the attachLogicalSessionsToOpCtx command override
- Backlog