Network leak due to msgPackedClones

Hello, i’m currently on fivem server but we have pl in zone cause of msgPackedClones at more than 2 000 000b.

Nework Metrics:

Network Drilldown Record (in zone)

Network Drilldown Record (outside zone)

3 Likes

Also in the onesync log file it seems the HandleCloneUpdate spams “unknown object” & “couldn’t create object” for 2 objects only in this “onesync” zone

2 Likes

Im also having the same problem in certain areas of the map, have you found a way to diagnose and fix this?

Delete

This happens when you have too many entities in one area, networked peds, objects, and vehicles each have a limit (sadly I cannot remember them off the top of my head).

If you go over this limit the entity can’t be created and the server will try to resend it because the client never ack’d the creation. This has been a long standing bug and a few fixes were attempted but they always had regressions so they were rolled back.

Thanks for the reply! :slight_smile: I created a command to check how many entities and network entities exist in my pool, but it dont seems a lot different from areas that are fine. Im trying to find out if it can be caused by the server spawning entities server side with bugged or missing models, but I didnt find a clear path to debug it
Here is the output from my command to check entities in the pool in the most affected area:
image

Is there any debug-solution for it as it is right now?
Because we have this problem, where it goes up to 2.000.000 b. , and then poeple get extremely high packet loss. I was wondering if it was because of devcore_qbus_smokev2 because thats spamming our console with alot of entity-creation related stuff.

Okay, thats wired. We want to run our server with TxAdmin, but we don’t want txAdmin to create two “instances” of OneSync, where is the best place to run OneSync from, is it from server.cfg or from TxAdmin itself?

And can i check somewhere if we are running two ‘instances’ of OneSync somehow?

You deeply misunderstand both the onesync convar and txAdmin.
When running txAdmin, you should set the configuration in the txAdmin settings page.
If you try to set onesync in your server.cfg, tx will automatically comment out the line with a very clear message:

## [txAdmin CFG validator]: onesync MUST only be set in the txAdmin settings page.
# set onesync legacy

Removing txAdmin didn’t fix the issue as much as nullified the effect of whatever you done to try to mess with the onesync convar.

Please, just go to the txAdmin settings page and set the onesync configuration you desire, which is probably “On (with infinity)” unless you have old or crappy resources.

Is there some way that i can figure out whats going on with the high packet loss, i mean check how many entities and stuff there is being spawned by the server, with a command or something?

Can you send a snipet of that code, so we can test it ourself?

if there was a way to debug the msgPackedClones message would be great, I tried with wireshark without success, just showed me that is a buffer of type 94

I ran this code on the client to determine if I reached the limit of entities

RegisterCommand('entitycount', function(source, args, rawCommand)
	local totalObjects = #GetGamePool('CObject')
	local totalPeds = #GetGamePool('CPed')
	local totalVehicles = #GetGamePool('CVehicle')
	local totalEntities = totalObjects + totalPeds + totalVehicles

	print("Total objects: " .. totalObjects)
	print("Total peds: " .. totalPeds)
	print("Total vehicles: " .. totalVehicles)
	print("Total entities: " .. totalEntities)
end, false)

I also checked if some script is spamming or sending large state bags updates, but it didnt show anything unusual

local function rejectStateChange(caller, ent, state, key, curVal)
    error(string.format("Reliable state bag packet overflow %s %s %s", ent, key, state))
end

AddStateBagChangeHandler("", "", function(bagName, key, value, source, replicated)
    -- global state isn't able to be set from the client
    if bagName == "global" then return end
    -- we're the ones that set this data, we don't want to possibly drop the
    -- player for it
    if not replicated then return end
    local ent
    local owner
    local state

    if bagName:find("entity") then
        ent = GetEntityFromStateBagName(bagName)
        owner = NetworkGetEntityOwner(ent)
        state = Entity(ent).state
    else
        ent = GetPlayerFromStateBagName(bagName)
        owner = ent
        state = Player(ent).state
    end

	print(string.format("UPDATED ENTITY BAG %s -  %s -  %s - %s", bagName, key, value, replicated))

    -- get the current value, the value of the current state wont change until
    -- after the state bag change handler finishes
    local curVal = state[key]
    if type(key) == "string" then
        -- keys should never be above 20 characters long, if it is then reject
        -- and drop the owning player
        if key:len() > 20 then
			print("TOO LARGE KEY", key)
            rejectStateChange(owner, ent, state, key, curVal)
        end
    end

    if isValueTooLarge(value) then
		print("TOO LARGE")
        rejectStateChange(owner, ent, state, key, curVal)
    end
end)

This also can be used on server side to check entities being created in an area:

----------------
local startTime = GetGameTimer() -- Script start time for reference

-- Function to check if entity is within the defined area
function isInArea(entity)
    local coords = GetEntityCoords(entity)

    return #(coords - vector3(14.72, -1123.85, 30.73)) < 200
end

-- Entity creation event handler
AddEventHandler('entityCreating', function(entity)
    local currentTime = GetGameTimer()
    local elapsedTime = (currentTime - startTime) / 1000 -- Time since script started (seconds)
    local entityType = GetEntityType(entity)
    local entityModel = GetEntityModel(entity)

    -- Check if entity is within the area and log details if so
    if isInArea(entity) then
        local logMessage = string.format(
            "[Entity Log] %.2f: Created entity %s %s(Type: %s, Model: %s)",
            entity,
            NetworkGetNetworkIdFromEntity(entity),
            elapsedTime,
            entityType,
            entityModel
        )
        lib.print.info(logMessage) -- Replace 'print' with your preferred logging method (e.g., file)
    end
end)

Hey, been having the same problem for a while.

Did you ever find a solution?