Repro for parachute freezing other players on OneSync Infinity

This is related to the random freezing problem on Infinity which was discussed recently on Discord
https://discordapp.com/channels/192358910387159041/297091831831855104/736978112381976657

Exact repro steps to cause client to freeze:

Server convars:

onesync_enabled true
onesync_enableInfinity true
onesync_enabledBeyond true
onesync_forceMigration true
onesync_distanceCulling true
onesync_distanceCullVehicles true

Players required: 2

  • Player A (mp ped male, probably irrelevant) and Player B (mp ped female) are placed 380-400m apart on level ground. Player A does nothing throughout this whole repro and is the one who will freeze.
  • Player B spawns a Hydra and noclips 100m straight up.
  • Player B types /para to ensure they have a parachute if they don’t already have one.
  • Player B turns off noclip and presses F to eject from the Hydra while it’s hovering.
  • Instantly “x is parachuting y meters away” is printed on player A’s console and their game freezes.

Client code:

RegisterCommand("para", function()
	GiveWeaponToPed(PlayerPedId(), `gadget_parachute`)
	print("ok")
end)

--this whole thread is unrelated and is not needed for the repro, just for demonstration
Citizen.CreateThread(function() 
	local lastPrint = {}
	while true do
		Citizen.Wait(0)
		local now = GetGameTimer()
		local myped = PlayerPedId()
		local pc = GetEntityCoords(myped)
		for _, p in pairs(GetActivePlayers()) do --loop through players and print if they are parachuting
			local ped = GetPlayerPed(p)
			if ped > 0 then
				local para = GetIsTaskActive(ped, 334)
				if (para) and now-(lastPrint[p] or 0) > 1000 then --only send prints every second
					lastPrint[p] = now
					print(string.format("%s is parachuting %.1f meters away", GetPlayerName(p), #(GetEntityCoords(ped)-pc)))
				end
			end
		end
	end
end)
1 Like

I can’t seem to replicate this hang at all when trying to make a parachuting player parachute while entering scope - the only thing I notice is that when a player is entering scope while parachuting (as opposed to starting parachuting while in scope), they’ll be jittery and the player animation will be stuck in freefall.

Are you perhaps able to make a script that’ll automate coordinate-setting on both players and parachute activation/direction on one player in order to induce this hang?

I only assumed it was related to scope entry in that Discord discussion, but it doesn’t seem to be at all.

The following client script will freeze player B
Player A types /playera
Player B types /playerb

RegisterCommand("playera", function()
	SetEntityCoords(PlayerPedId(), 1700.5, 3252.2, 40.2)
end)

RegisterCommand("playerb", function()
	local ped = PlayerPedId()
	SetEntityInvincible(ped, true)
	SetEntityCoords(ped, 1341.4, 3152.1, 39.7)
	Citizen.Wait(500)

	local hydra = GetHashKey("hydra")
	RequestModel(hydra)
	while not HasModelLoaded(hydra) do
		Citizen.Wait(500)
	end

	local v = CreateVehicle(hydra, 1341.4, 3152.1, 140.0, 280.0, true)
	SetPedIntoVehicle(ped, v, -1)
	SetModelAsNoLongerNeeded(hydra)

	GiveWeaponToPed(ped, GetHashKey("gadget_parachute"))

	Citizen.Wait(100)
	TaskLeaveVehicle(ped, v, 0)

	Citizen.Wait(2000)
	DeleteVehicle(v)
end)

Just noclipping up and skydiving normally did not cause any freezes. Only once we tried ejecting from the Hydra is when we encountered the freezes. We didn’t try any other scenarios since this one worked.

Repro seems good, I was also able to reproduce on a OneSync legacy server so it’s probably not related to Infinity.

Server Info:
Server Build 2744
Convars:

+set onesync_enabled true
onesync_distanceCullVehicles true
onesync_forceMigration true
onesync_workaround763185 true

Here’s a very ghetto but functional temporary fix that prevents this issue from occurring.
It basically just checks if the player has a parachute equipped while falling and teleports them safely to the ground before anyone gets a chance to freeze.
It might not fit RP scenarios but it works fine for our use cases.

Citizen.CreateThread(function()
    while true do
        local ped = PlayerPedId()

        if(HasPedGotWeapon(ped, `gadget_parachute`) and GetPedParachuteState(ped) ~= -1) then
            local coords = GetEntityCoords(ped)
            local retval, groundZ = GetGroundZFor_3dCoord(coords.x, coords.y, coords.z, 0)
            SetEntityCoords(ped, coords.x, coords.y, groundZ)

            -- might want to put something here instead of a print, like a proper notification for example
            print("[FreezeTempFix] Teleporting to ground in order to prevent a freeze (this is temporary until a proper fix is made to the FiveM client)")
            Wait(150)
        end

        Wait(0)
    end
end)

Right.

This seems to be caused by :drum: :drum: :drum: the rate limiting loop for scene update calls in gta-net-five that was meant to improve performance for faraway entities on legacy 1s.

(unrelatedly, I like how an undeployed parachute isn’t correctly made invisible somehow, so it’s weirdly trailing the freefalling player. this is a completely separate todo item of course)

And fixed by tracking entity flags when they get added/removed and adding this to the cached flag list.

Undeployed parachute stuff is on todo list meanwhile.

1 Like

Hello. Have you been able to solve this problem? I have a Battle Royale server that hosts over 1000 players, and it has been hell. Especially since users with hacking abilities can cause this crash at any time.