|
The race was introduced as part of SERVER-82751 because every time we create a Client, we read serverGlobalParams.clusterRole to check if is a router client. This is safe in production since serverGlobalParams.clusterRole is only set during startup. However, it is causing race in unit tests because we deliberately set serverGlobalParams.clusterRole to whatever each unit test needs to do the testing. Given that Session::isFromRouterPort() can only be true when the transport layer has a router port which can only be true on a mongod with RouterServer role. There is no need to the roles in addition to check isFromRouterPort() when creating a Client, especially since it causes races in a lot of unit tests which would require a lot of effort to rewrite to avoid the race.
|