MicroProfiler is running out of labels, showing incorrect stack traces and nulls

The MicroProfiler for our game is no longer useful because it is “corrupted”. We don’t use any custom labels as of recent, and this is still a problem. Impossible stack traces are showing up and also Script_null’s.

A private message is associated with this bug report

2 Likes

I looked at the MP dump that you posted but I couldn’t see any script_nulls. I’ve also tried taking a few in-experience but no issues show up.
Is there a good way to reproduce this? I would love to be able to do that.

Sharing some of Joey’s screenshots here:


image

“no Raycasting is performed under ClientMagicOrbs”
“even in any functions that it calls as well”
“i’ve noticed this happens frequently to things that are bound to RenderStepped”

RunService:BindToRenderStep("MagicOrbs", Enum.RenderPriority.Last.Value, function(dt)
    for player, instance in pairs(playerInstances) do
        if instance:IsDestroyed() then
            playerInstances[player] = nil
            continue
        end
        instance:RenderStepped(dt)
        if instance:IsDestroyed() then
            playerInstances[player] = nil
        end
    end
end)

Added another dump to the Jira issue that has Script_null tags.

I can see some script_nulls so we are running out of label space. I can see that the oldest frames have all scripts with “_null” but none of them after that have this problem. In other words we have space for labels in the most recent frames and shorter captures would be fine.

I played this experience in the debugger and It seems that the instance:RenderStepped(dt) is leading to raycasts from various scripts including:

  1. Parallel Pet Controller - performPlayerRaycast and performStandardRaycast
  2. Breakables Frontend - property update → getMousePart
  3. CameraModule.ZoomController.Popper - queryPoint()

Following up on this – if we remove the usage of BindToRenderStep and instead use RenderStepped:Connect, the mislabeling issue is resolved.

We’re now using this (hilarious) wrapper for BindToRenderStep that allows us to take accurate microprofiler dumps:

--!strict

local RunService = game:GetService("RunService")

local whitelist = { 
	[1210210] = true,
	[2882755487] = true,
}

local TESTING = false
if game.GameId == 5349377275 then
	if RunService:IsClient() and whitelist[game.Players.LocalPlayer.UserId] then
		TESTING = true
	end
end

if TESTING then
	return function(name: string, priority: number, callback: (dt: number) -> ()): (() -> ())
		local connection = RunService.RenderStepped:Connect(callback)
		return function()
			connection:Disconnect()
		end
	end
end

return function(name: string, priority: number, callback: (dt: number) -> ()): (() -> ())
	RunService:BindToRenderStep(name, priority, callback)
	return function()
		RunService:UnbindFromRenderStep(name)
	end
end