Somehow, the TransactionCoordinator, which appears to only take a mutex(es) in its own implementation, managed to invariant in ~LockerImpl after failing to acquire the global lock for a document write sub-operation via the DBDirectClient.
It's unclear to me what could have gone wrong. The TransactionParticipant is the only component in the codebase using Locker instances outside of RAII types, but the TransactionCoordinator isn't involved with the TransactionParticipant at all as far as I can tell. We could add some logging information to the invariant failure. It isn't clear what information would be helpful, so basically whatever we can. ~LockerImpl checks that the lock requests are empty, which is a map of ResourceId to LockRequest -- we could log some of this information.
The invariant failure was seen in the v4.2 branch.