The sharding balancer's statistics generation uses shardutil::retrieveTotalShardSize on each round in order to retrieve the shard's storage utilization.
This in turn calls listDatabases against the shard, but does not use maxTimeMS or timeout, which can cause the balancer to get stuck indefinitely.