Jump to content

Server crashing HELP


juaosilv

Recommended Posts

Hello, I need some help. I recently opened my server and the higher the number of players the more lag of FPS and network was getting.

I use a good dedicated and with plenty of GB / CPU / Internet, but still my crasha server after a while online, a friend told me that I would need to do something to make the MTA server use all the CPUs of the machine.

Does anyone know how I can do this?

I know the problem is not my machine because I analyzed the performance of the VPS and was using almost nothing and was still crashing.

I'm sorry for my bad english.

To summarize what I said: I am having problems with crashing, when I have many players the server is crashing and the download is slow.

 

Error before crashing: InResultQueue > 200000 msgs. This is due to server overload or script freeze

Edited by juaosilv
Link to comment
7 minutes ago, IIYAMA said:

Either a bad resource (< check that) or a DDOS attack if somebody doesn't like you.

I already checked resources a few minutes before falling and not anything out of the ordinary. And about DDOS attacks, it is not because when I receive attacks I get an email warning and can see through the management panel of the machine.

I'm running out of solutions already :(

Link to comment
  • Moderators
2 hours ago, juaosilv said:

I already checked resources a few minutes before falling and not anything out of the ordinary. And about DDOS attacks, it is not because when I receive attacks I get an email warning and can see through the management panel of the machine.

I'm running out of solutions already :(

Tell me the result of this code: (serverside)

Note: Untested code

local eventList = {}

setTimer(function () 
	if next(eventList) then
		outputDebugString(inspect(eventList))
		eventList = {}
	end
end, 10000, 0)


addDebugHook( "preEvent", function ( sourceResource, eventName, eventSource, eventClient, luaFilename, luaLineNumber, ... )
	eventList[eventName] = (eventList[eventName] and eventList[eventName] + 1) or 1
end)

 

  1. Test what the first output is in the log files. (because this is the first time I am using this event)

    If everything is working then:
  2. Test with a low amount of players.
  3. Test with a high amount of players.

 

 

 

Link to comment
On 03/08/2019 at 09:47, IIYAMA said:

Either a bad resource (< check that) or a DDOS attack if somebody doesn't like you.

Hello, that was the data with few online:

Spoiler

 

INFO: {
  onConsole = 5,
  onElementDataChange = 17,
  onPlayerCommand = 5,
  onPlayerTarget = 5,
  onPlayerWeaponSwitch = 4,
  onResourceStart = 1,
  removeAnimation = 1
}
[19-08-03 23:18:24] INFO: {
  onConsole = 1,
  onElementDataChange = 12,
  onPlayerCommand = 1,
  onPlayerContact = 2,
  removeAnimation = 2
}
[19-08-03 23:18:34] INFO: {
  onElementDataChange = 10
}

INFO: {
  onConsole = 1,
  onDebugMessage = 1,
  onElementDataChange = 11,
  onPlayerCommand = 2,
  onPlayerContact = 1,
  onResourcePreStart = 1,
  onResourceStart = 1
}

INFO: {
  onConsole = 1,
  onDebugMessage = 1,
  onElementDataChange = 14,
  onPlayerCommand = 1
}

 

INFO: {
  onElementDataChange = 10,
  onElementDestroy = 4
}

 

With 20 online:

 

INFO: {
  GGbindMouseRoll = 1,
  aPermissions = 1,
  boneAttach_requestAttachmentData = 1,
  getElementItems = 1,
  onElementDataChange = 117,
  onElementDestroy = 54,
  onMarkerHit = 6,
  onNotifyTargetEnabled = 1,
  onPlayerConnect = 2,
  onPlayerJoin = 5,
  onPlayerSpawn = 5,
  onResourceLoadedAtClient_internal = 1,
  removeAnimation = 1,
  requestLODsClient = 6
}
[19-08-03 23:19:34] INFO: {
  GGbindMouseRoll = 3,
  ["Inventory->checkWeapons"] = 1,
  aPermissions = 2,
  aPlayerVersion = 1,
  boneAttach_requestAttachmentData = 2,
  driveby_clientScriptLoaded = 1,
  getElementItems = 1,
  onAskForBubbleSettings = 1,
  onClientSync = 3,
  onElementDataChange = 87,
  onNotifyTargetEnabled = 1,
  onOpenGui = 1,
  onPlayerACInfo = 1,
  onPlayerContact = 7,
  onPlayerTarget = 4,
  onResourceLoadedAtClient_internal = 2,
  removeJoin = 1,
  requestLODsClient = 18
}
[19-08-03 23:19:44] INFO: {
  aPlayerVersion = 1,
  ["loader.onload"] = 1,
  onElementDataChange = 87,
  onPlayerClick = 2,
  onPlayerContact = 2,
  onPlayerTarget = 9,
  removeAnimation = 3,
  requestLODsClient = 1,
  requestModSizes = 1

 

INFO: {
  ["Inventory->checkWeapons"] = 1,
  getElementItems = 1,
  onAccountLoadData = 1,
  onElementDataChange = 138,
  onElementDestroy = 1,
  onPlayerClick = 6,
  onPlayerContact = 1,
  onPlayerLogin = 1,
  onPlayerMoneyChange = 1,
  onPlayerNetworkStatus = 1,
  onPlayerRequestLogin = 1
}

 

INFO: {
  ["Inventory->checkWeapons"] = 1,
  aPermissions = 2,
  aPlayerVersion = 2,
  boneAttach_requestAttachmentData = 2,
  driveby_clientScriptLoaded = 1,
  getElementItems = 1,
  onAskForBubbleSettings = 1,
  onClientSync = 2,
  onElementDataChange = 99,
  onElementDestroy = 1,
  onNotifyTargetEnabled = 1,
  onOpenGui = 1,
  onPlayerACInfo = 1,
  onPlayerConnect = 2,
  onResourceLoadedAtClient_internal = 2,
  removeJoin = 1,
  requestLODsClient = 16
}

 

INFO: {
  GGbindMouseRoll = 1,
  aPermissions = 1,
  boneAttach_requestAttachmentData = 1,
  getElementItems = 1,
  ["loader.onload"] = 1,
  onClientSync = 1,
  onElementDataChange = 142,
  onNotifyTargetEnabled = 1,
  onPlayerConnect = 1,
  onPlayerJoin = 3,
  onPlayerSpawn = 3,
  onPlayerTarget = 4,
  onResourceLoadedAtClient_internal = 1,
  requestLODsClient = 10,
  requestModSizes = 1
}
[19-08-03 23:20:34] INFO: {
  ["Inventory->checkWeapons"] = 3,
  aPermissions = 2,
  aPlayerVersion = 3,
  boneAttach_requestAttachmentData = 4,
  driveby_clientScriptLoaded = 3,
  getElementItems = 1,
  ["loader.onload"] = 1,
  onAskForBubbleSettings = 3,
  onChatMessage = 1,
  onClientSync = 4,
  onConsole = 1,
  onElementDataChange = 156,
  onNotifyTargetEnabled = 2,
  onOpenGui = 3,
  onPlayerACInfo = 1,
  onPlayerClick = 4,
  onPlayerCommand = 1,
  onResourceLoadedAtClient_internal = 2,
  removeJoin = 3,
  requestLODsClient = 29,
  requestModSizes = 1
}

 

NFO: {
  ["Inventory->checkWeapons"] = 1,
  aPermissions = 2,
  boneAttach_requestAttachmentData = 2,
  getElementItems = 3,
  ["loader.onload"] = 2,
  onAccountLoadData = 1,
  onClientSync = 1,
  onElementDataChange = 202,
  onElementDestroy = 2,
  onElementModelChange = 1,
  onNotifyTargetEnabled = 3,
  onPlayerClick = 7,
  onPlayerLogin = 1,
  onPlayerMoneyChange = 1,
  onPlayerRequestLogin = 2,
  onPlayerTarget = 2,
  onResourceLoadedAtClient_internal = 2,
  removeAnimation = 2,
  requestLODsClient = 16,
  requestModSizes = 2
}

 

 INFO: {
  ["Inventory->checkWeapons"] = 3,
  aPlayerVersion = 1,
  boneAttach_requestAttachmentData = 1,
  driveby_clientScriptLoaded = 2,
  getElementItems = 1,
  ["loader.onload"] = 1,
  onAccountLoadData = 1,
  onAskForBubbleSettings = 2,
  onClientSync = 3,
  onElementDataChange = 228,
  onElementDestroy = 2,
  onElementModelChange = 1,
  onOpenGui = 2,
  onPlayerClick = 8,
  onPlayerCommand = 1,
  onPlayerConnect = 2,
  onPlayerJoin = 2,
  onPlayerLogin = 1,
  onPlayerMoneyChange = 1,
  onPlayerRequestLogin = 1,
  onPlayerSpawn = 2,
  onResourcePreStart = 1,
  onResourceStart = 1,
  onResourceStop = 1,
  removeAnimation = 4,
  removeJoin = 1,
  requestLODsClient = 15,
  requestModSizes = 1
}

 INFO: {
  GGbindMouseRoll = 1,
  addVoice = 3,
  onColShapeLeave = 4,
  onConsole = 10,
  onDebugMessage = 3,
  onElementColShapeLeave = 4,
  onElementDataChange = 15251,
  onElementDestroy = 4,
  onElementStartSync = 1,
  onMarkerHit = 4,
  onMarkerLeave = 4,
  onPlayerChat = 1,
  onPlayerCommand = 11,
  onPlayerContact = 7,
  onPlayerDamage = 4,
  onPlayerMarkerHit = 4,
  onPlayerMarkerLeave = 4,
  onPlayerMoneyChange = 1,
  onPlayerTarget = 71,
  onPlayerVoiceStart = 3,
  onPlayerVoiceStop = 3,
  onPlayerWeaponSwitch = 1,
  onVehicleDamage = 20,
  removeAnimation = 9,
  removeVoice = 3
}

 INFO: {
  GGbindMouseRoll = 4,
  ["Inventory->checkWeapons"] = 1,
  aPermissions = 1,
  aPlayerVersion = 1,
  addVoice = 1,
  boneAttach_requestAttachmentData = 1,
  driveby_clientScriptLoaded = 1,
  getElementItems = 1,
  onAskForBubbleSettings = 1,
  onClientSync = 2,
  onColShapeLeave = 2,
  onConsole = 11,
  onDebugMessage = 5,
  onElementColShapeLeave = 2,
  onElementDataChange = 15213,
  onElementDestroy = 6,
  onElementStartSync = 1,
  onElementStopSync = 1,
  onMarkerHit = 3,
  onMarkerLeave = 2,
  onNotifyTargetEnabled = 1,
  onOpenGui = 1,
  onPlayerClick = 2,
  onPlayerCommand = 11,
  onPlayerContact = 5,
  onPlayerDamage = 10,
  onPlayerMarkerHit = 3,
  onPlayerMarkerLeave = 2,
  onPlayerMoneyChange = 2,
  onPlayerNetworkStatus = 2,
  onPlayerTarget = 106,
  onPlayerVehicleEnter = 1,
  onPlayerVehicleExit = 1,
  onPlayerVoiceStart = 1,
  onPlayerVoiceStop = 1,
  onPlayerWeaponSwitch = 2,
  onResourceLoadedAtClient_internal = 1,
  onVehicleDamage = 1,
  onVehicleEnter = 1,
  onVehicleExit = 1,
  onVehicleStartEnter = 1,
  onVehicleStartExit = 1,
  removeAnimation = 29,
  removeVoice = 1,
  requestLODsClient = 15,
  sendBugMessageToAdmins = 1
}
[19-08-03 23:32:25] INFO: {
  ClicarJogador = 6,
  ClickJogadorCurar = 6,
  ["DNL:Reparar"] = 1,
  GGbindMouseRoll = 1,
  addVoice = 1,
  ggun_take = 1,
  onChatMessage = 1,
  onColShapeHit = 1,
  onColShapeLeave = 2,
  onConsole = 15,
  onElementClicked = 13,
  onElementColShapeHit = 1,
  onElementColShapeLeave = 2,
  onElementDataChange = 13834,
  onElementDestroy = 5,
  onMarkerHit = 3,
  onMarkerLeave = 1,
  onPlayerChat = 2,
  onPlayerClick = 14,
  onPlayerCommand = 17,
  onPlayerContact = 4,
  onPlayerDamage = 1,
  onPlayerMarkerHit = 3,
  onPlayerMarkerLeave = 1,
  onPlayerMoneyChange = 1,
  onPlayerTarget = 42,
  onPlayerVoiceStart = 1,
  onPlayerWeaponSwitch = 3,
  onVehicleDamage = 2,
  removeAnimation = 23,
  removeVoice = 1
}
[19-08-03 23:32:35] INFO: {
  GGbindMouseRoll = 1,
  addVoice = 2,
  boneAttach_requestAttachmentData = 1,
  ggun_drop = 1,
  onColShapeLeave = 2,
  onConsole = 4,
  onElementColShapeLeave = 2,
  onElementDataChange = 15240,
  onElementDestroy = 9,
  onMarkerHit = 3,
  onMarkerLeave = 2,
  onPlayerChat = 3,
  onPlayerCommand = 7,
  onPlayerMarkerHit = 3,
  onPlayerMarkerLeave = 2,
  onPlayerMoneyChange = 1,
  onPlayerTarget = 40,
  onPlayerVehicleEnter = 1,
  onPlayerVoiceStart = 1,
  onPlayerVoiceStop = 2,
  onPlayerWeaponSwitch = 1,
  onVehicleEnter = 1,
  onVehicleStartEnter = 1,
  removeAnimation = 7,
  removeVoice = 2,
  requestLODsClient = 1,
  requestModSizes = 1
}
[19-08-03 23:32:45] INFO: {
  GGbindMouseRoll = 1,
  ["lspd:toggleFlashers"] = 1,
  onColShapeLeave = 1,
  onConsole = 4,
  onElementColShapeLeave = 1,
  onElementDataChange = 18725,
  onElementDestroy = 6,
  onElementStartSync = 1,
  onMarkerHit = 3,
  onMarkerLeave = 1,
  onPlayerChat = 1,
  onPlayerCommand = 5,
  onPlayerContact = 7,
  onPlayerDamage = 1,
  onPlayerMarkerHit = 3,
  onPlayerMarkerLeave = 1,
  onPlayerMoneyChange = 3,
  onPlayerTarget = 20,
  onPlayerWeaponSwitch = 1,
  removeAnimation = 5,
  sendBugMessageToAdmins = 1
}

 

[19-08-03 23:39:45] INFO: {
  SirenSinc = 2,
  addVoice = 4,
  engineswitch = 1,
  onAccountDataChange = 82,
  onAccountSaveData = 1,
  onChatMessage = 1,
  onColShapeLeave = 5,
  onConsole = 4,
  onDebugMessage = 3,
  onElementColShapeLeave = 5,
  onElementDataChange = 17792,
  onElementDestroy = 10,
  onElementStartSync = 1,
  onElementStopSync = 1,
  onMarkerHit = 6,
  onMarkerLeave = 3,
  onPickupHit = 2,
  onPickupSpawn = 2,
  onPickupUse = 2,
  onPlayerChat = 1,
  onPlayerCommand = 5,
  onPlayerContact = 7,
  onPlayerMarkerHit = 6,
  onPlayerMarkerLeave = 3,
  onPlayerMoneyChange = 3,
  onPlayerPickupHit = 2,
  onPlayerPickupUse = 2,
  onPlayerQuit = 1,
  onPlayerTarget = 23,
  onPlayerVoiceStart = 3,
  onPlayerVoiceStop = 2,
  onResourcePreStart = 1,
  onResourceStart = 1,
  onVehicleDamage = 1,
  removeAnimation = 12,
  removeVoice = 2
}

[19-08-03 23:39:25] INFO: {
  GGbindMouseRoll = 1,
  ["Inventory->checkWeapons"] = 1,
  getElementItems = 1,
  onAccountLoadData = 1,
  onColShapeLeave = 5,
  onConsole = 5,
  onDebugMessage = 1,
  onElementColShapeLeave = 5,
  onElementDataChange = 19477,
  onElementDestroy = 59,
  onElementModelChange = 1,
  onElementStartSync = 2,
  onElementStopSync = 2,
  onMarkerHit = 14,
  onMarkerLeave = 5,
  onPlayerClick = 4,
  onPlayerCommand = 5,
  onPlayerContact = 6,
  onPlayerDamage = 1,
  onPlayerLogin = 1,
  onPlayerMarkerHit = 8,
  onPlayerMarkerLeave = 5,
  onPlayerMoneyChange = 4,
  onPlayerRequestLogin = 1,
  onPlayerTarget = 15,
  removeAnimation = 7
}
[19-08-03 23:39:35] INFO: {
  ["DNL:Reparar"] = 1,
  GGbindMouseRoll = 11,
  SirenSinc = 2,
  addVoice = 2,
  onChatMessage = 1,
  onColShapeLeave = 5,
  onConsole = 8,
  onElementClicked = 2,
  onElementColShapeLeave = 5,
  onElementDataChange = 20232,
  onElementDestroy = 7,
  onElementStartSync = 1,
  onElementStopSync = 1,
  onMarkerHit = 9,
  onMarkerLeave = 5,
  onPlayerClick = 6,
  onPlayerCommand = 8,
  onPlayerContact = 8,
  onPlayerMarkerHit = 8,
  onPlayerMarkerLeave = 5,
  onPlayerMoneyChange = 2,
  onPlayerTarget = 33,
  onPlayerVoiceStart = 2,
  onPlayerVoiceStop = 2,
  onPlayerWeaponSwitch = 2,
  removeAnimation = 17,
  removeVoice = 2
}

 

 

Could not get many players now, is lagged in the range of 40-60. But I think with this data you can get an idea of what it is.

Edited by DNL291
spoiler for the code
Link to comment
  • Moderators
4 hours ago, juaosilv said:

Could not get many players now, is lagged in the range of 40-60. But I think with this data you can get an idea of what it is.

Yes, this is what is killing your server

[19-08-03 23:39:35] INFO: {
  ["DNL:Reparar"] = 1,
  GGbindMouseRoll = 11,
  SirenSinc = 2,
  addVoice = 2,
  onChatMessage = 1,
  onColShapeLeave = 5,
  onConsole = 8,
  onElementClicked = 2,
  onElementColShapeLeave = 5,
  onElementDataChange = 20232,
  onElementDestroy = 7,
  onElementStartSync = 1,
  onElementStopSync = 1,
  onMarkerHit = 9,
  onMarkerLeave = 5,
  onPlayerClick = 6,
  onPlayerCommand = 8,
  onPlayerContact = 8,
  onPlayerMarkerHit = 8,
  onPlayerMarkerLeave = 5,
  onPlayerMoneyChange = 2,
  onPlayerTarget = 33,
  onPlayerVoiceStart = 2,
  onPlayerVoiceStop = 2,
  onPlayerWeaponSwitch = 2,
  removeAnimation = 17,
  removeVoice = 2
}

 

As in elementdata changes. So check that out.

Link to comment
local eventList = {}

setTimer(
  function () 
    if next(eventList) then
      outputDebugString(inspect(eventList))
      eventList = {}
    end
  end, 10000, 0
)


addDebugHook( "preEvent", 
  function ( sourceResource, eventName, eventSource, eventClient, luaFilename, luaLineNumber, ... )
    local i = inspect(sourceResource).."/"..eventName.."/"..inspect(eventSource)
    eventList[i] = (eventList[i] and eventList[i] + 1) or 1
  end, "onElementDataChange"
)

You could use this slightly adapted IIYAMA's code (only hooking onto onElementDataChange this time) which also includes the name of the resource and a readable identifier for the source element into the list, so you can tell which resource causes the large amount of data changes.

Edited by MrTasty
  • Like 1
Link to comment
  • Scripting Moderators

From my own experience i want to say i had something similar with elementData. I don't say that element data is that bad, but it can cause problem like yours if not used correctly. That's why i moved everything on data system which use triggers and tables.

Link to comment
9 hours ago, IIYAMA said:

Yes, this is what is killing your server

[19-08-03 23:39:35] INFO: {
  ["DNL:Reparar"] = 1,
  GGbindMouseRoll = 11,
  SirenSinc = 2,
  addVoice = 2,
  onChatMessage = 1,
  onColShapeLeave = 5,
  onConsole = 8,
  onElementClicked = 2,
  onElementColShapeLeave = 5,
  onElementDataChange = 20232,
  onElementDestroy = 7,
  onElementStartSync = 1,
  onElementStopSync = 1,
  onMarkerHit = 9,
  onMarkerLeave = 5,
  onPlayerClick = 6,
  onPlayerCommand = 8,
  onPlayerContact = 8,
  onPlayerMarkerHit = 8,
  onPlayerMarkerLeave = 5,
  onPlayerMoneyChange = 2,
  onPlayerTarget = 33,
  onPlayerVoiceStart = 2,
  onPlayerVoiceStop = 2,
  onPlayerWeaponSwitch = 2,
  removeAnimation = 17,
  removeVoice = 2
}

 

As in elementdata changes. So check that out.

How do you know this is it? Is there a limit of elementData? Because every other onElementDataChnge has values almost similar to this

Link to comment
  • Moderators
1 hour ago, juaosilv said:

How do you know this is it? Is there a limit of elementData? Because every other onElementDataChnge has values almost similar to this

I know this is it because:

 

 Most people do not know that synchronize is enabled by default.

 
  1. bool setElementData ( element theElement, string key, var value [, bool synchronize = true ] )

When the synchronize argument is enabled, each function call represents data that is transferring between all clients and the server.

 

And your server said:

Quote

Error before crashing: InResultQueue > 200000 msgs. This is due to server overload or script freeze

Those are network messages.

 

 

Isn't a coincidence?

 

 

And if I were guessing what so much messages is producing, then this code would look a bit like this situation:

addEventHandler("onClientRender", root, 
function () 
	setElementData(root, ":O", true)  
end)

 

 

 

 

 

 

 

 

 

 

Edited by IIYAMA
Link to comment
4 hours ago, IIYAMA said:

I know this is it because:

 

 Most people do not know that synchronize is enabled by default.


 
  1.  
  1. bool setElementData ( element theElement, string key, var value [, bool synchronize = true ] )

When the synchronize argument is enabled, each function call represents data that is transferring between all clients and the server.

 

And your server said:

Those are network messages.

 

 

Isn't a coincidence?

 

 

And if I were guessing what so much messages is producing, then this code would look a bit like this situation:


addEventHandler("onClientRender", root, 
function () 
	setElementData(root, ":O", true)  
end)

 

 

 

 

 

 

 

 

 

 

I didn't understand much but I could understand. kkkkkkkkkkkk

 

How can I solve this problem? Code below:

function Repair_Vehicle ( Car )
local cx, cy, cz = getElementPosition ( Car )
local px, py, pz = getElementPosition ( source )
local distance	= getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz )
local accountname = getAccountName(getPlayerAccount(source))
  if getElementData(source, "Reparando", true) then 
  return end
  
if getElementData(source, "player:KitR") < 1 then
return   		  
end
	
   if ( distance <= 1.7 ) then
 if getElementData ( source, "player:Job" ) == "Mecanico" then
		setPedAnimation( source, "CAMERA", "piccrch_take", 3000, true, false, false, false)
		triggerClientEvent (source, "DNL:RepararStart", source)
		setElementData(source, "player:KitR", getElementData(source, "player:KitR") - 1)
		
		setTimer(function()
	         fixVehicle ( Car )
		end, 3000, 1)
     end
   end
end
addEvent ( "DNL:Reparar", true )
addEventHandler ( "DNL:Reparar", root, Repair_Vehicle)

 

Link to comment
  • Moderators
2 hours ago, juaosilv said:

How can I solve this problem? Code below:

The event DNL:Reparar didn't trigger that much. Are you sure this is the code that called the setElementData so much?

It is about the execution quantity after all.

 

Make sure to run @MrTasty

his code to figure out if where it is actually located.

 

 

 

 

Link to comment
  • Moderators

After your new test (with MrTasty's code) I suggest you temporarily remove from your server (if possible) every resource that has a high setElementData usage rate, to make sure your issue is or not related to that.

 

10 hours ago, IIYAMA said:

And if I were guessing what so much messages is producing, then this code would look a bit like this situation:


addEventHandler("onClientRender", root, 
function () 
	setElementData(root, ":O", true)  
end)

That would not be enough to cause any problems since the value is always the same and will not be updated, I am right?

Off-topic: DNL in the event name has nothing to do with me xD

Link to comment
  • Moderators
2 hours ago, DNL291 said:

That would not be enough to cause any problems since the value is always the same and will not be updated, I am right?

At first yes you would expect that.

But there is one thing that isn't taken in account.

If one of the other clients does this:

setElementData(root, ":O", false, false)

 

In that case, even if the value doesn't change, the value of this specific client must be updated. With other words it does not matter if the value is the same. All clients their value must be forced to set to the last known value.

 

 I don't know if the event is fired or not. But it is just as bad for the network.

 

 

Edited by IIYAMA
  • Like 1
Link to comment
4 hours ago, IIYAMA said:

The event DNL:Reparar didn't trigger that much. Are you sure this is the code that called the setElementData so much?

It is about the execution quantity after all.

 

Make sure to run @MrTasty

his code to figure out if where it is actually located.

 

 

 

 

Not sure, but according to the data you sent up there, he says it's that function.

Link to comment
18 hours ago, IIYAMA said:

 

Can you show me the results?

The results I say I sent you are those up there.

 

Quote
Spoiler

 

INFO: {
  onConsole = 5,
  onElementDataChange = 17,
  onPlayerCommand = 5,
  onPlayerTarget = 5,
  onPlayerWeaponSwitch = 4,
  onResourceStart = 1,
  removeAnimation = 1
}
[19-08-03 23:18:24] INFO: {
  onConsole = 1,
  onElementDataChange = 12,
  onPlayerCommand = 1,
  onPlayerContact = 2,
  removeAnimation = 2
}
[19-08-03 23:18:34] INFO: {
  onElementDataChange = 10
}

INFO: {
  onConsole = 1,
  onDebugMessage = 1,
  onElementDataChange = 11,
  onPlayerCommand = 2,
  onPlayerContact = 1,
  onResourcePreStart = 1,
  onResourceStart = 1
}

INFO: {
  onConsole = 1,
  onDebugMessage = 1,
  onElementDataChange = 14,
  onPlayerCommand = 1
}

 

INFO: {
  onElementDataChange = 10,
  onElementDestroy = 4
}

 

With 20 online:

 

INFO: {
  GGbindMouseRoll = 1,
  aPermissions = 1,
  boneAttach_requestAttachmentData = 1,
  getElementItems = 1,
  onElementDataChange = 117,
  onElementDestroy = 54,
  onMarkerHit = 6,
  onNotifyTargetEnabled = 1,
  onPlayerConnect = 2,
  onPlayerJoin = 5,
  onPlayerSpawn = 5,
  onResourceLoadedAtClient_internal = 1,
  removeAnimation = 1,
  requestLODsClient = 6
}
[19-08-03 23:19:34] INFO: {
  GGbindMouseRoll = 3,
  ["Inventory->checkWeapons"] = 1,
  aPermissions = 2,
  aPlayerVersion = 1,
  boneAttach_requestAttachmentData = 2,
  driveby_clientScriptLoaded = 1,
  getElementItems = 1,
  onAskForBubbleSettings = 1,
  onClientSync = 3,
  onElementDataChange = 87,
  onNotifyTargetEnabled = 1,
  onOpenGui = 1,
  onPlayerACInfo = 1,
  onPlayerContact = 7,
  onPlayerTarget = 4,
  onResourceLoadedAtClient_internal = 2,
  removeJoin = 1,
  requestLODsClient = 18
}
[19-08-03 23:19:44] INFO: {
  aPlayerVersion = 1,
  ["loader.onload"] = 1,
  onElementDataChange = 87,
  onPlayerClick = 2,
  onPlayerContact = 2,
  onPlayerTarget = 9,
  removeAnimation = 3,
  requestLODsClient = 1,
  requestModSizes = 1

 

INFO: {
  ["Inventory->checkWeapons"] = 1,
  getElementItems = 1,
  onAccountLoadData = 1,
  onElementDataChange = 138,
  onElementDestroy = 1,
  onPlayerClick = 6,
  onPlayerContact = 1,
  onPlayerLogin = 1,
  onPlayerMoneyChange = 1,
  onPlayerNetworkStatus = 1,
  onPlayerRequestLogin = 1
}

 

INFO: {
  ["Inventory->checkWeapons"] = 1,
  aPermissions = 2,
  aPlayerVersion = 2,
  boneAttach_requestAttachmentData = 2,
  driveby_clientScriptLoaded = 1,
  getElementItems = 1,
  onAskForBubbleSettings = 1,
  onClientSync = 2,
  onElementDataChange = 99,
  onElementDestroy = 1,
  onNotifyTargetEnabled = 1,
  onOpenGui = 1,
  onPlayerACInfo = 1,
  onPlayerConnect = 2,
  onResourceLoadedAtClient_internal = 2,
  removeJoin = 1,
  requestLODsClient = 16
}

 

INFO: {
  GGbindMouseRoll = 1,
  aPermissions = 1,
  boneAttach_requestAttachmentData = 1,
  getElementItems = 1,
  ["loader.onload"] = 1,
  onClientSync = 1,
  onElementDataChange = 142,
  onNotifyTargetEnabled = 1,
  onPlayerConnect = 1,
  onPlayerJoin = 3,
  onPlayerSpawn = 3,
  onPlayerTarget = 4,
  onResourceLoadedAtClient_internal = 1,
  requestLODsClient = 10,
  requestModSizes = 1
}
[19-08-03 23:20:34] INFO: {
  ["Inventory->checkWeapons"] = 3,
  aPermissions = 2,
  aPlayerVersion = 3,
  boneAttach_requestAttachmentData = 4,
  driveby_clientScriptLoaded = 3,
  getElementItems = 1,
  ["loader.onload"] = 1,
  onAskForBubbleSettings = 3,
  onChatMessage = 1,
  onClientSync = 4,
  onConsole = 1,
  onElementDataChange = 156,
  onNotifyTargetEnabled = 2,
  onOpenGui = 3,
  onPlayerACInfo = 1,
  onPlayerClick = 4,
  onPlayerCommand = 1,
  onResourceLoadedAtClient_internal = 2,
  removeJoin = 3,
  requestLODsClient = 29,
  requestModSizes = 1
}

 

NFO: {
  ["Inventory->checkWeapons"] = 1,
  aPermissions = 2,
  boneAttach_requestAttachmentData = 2,
  getElementItems = 3,
  ["loader.onload"] = 2,
  onAccountLoadData = 1,
  onClientSync = 1,
  onElementDataChange = 202,
  onElementDestroy = 2,
  onElementModelChange = 1,
  onNotifyTargetEnabled = 3,
  onPlayerClick = 7,
  onPlayerLogin = 1,
  onPlayerMoneyChange = 1,
  onPlayerRequestLogin = 2,
  onPlayerTarget = 2,
  onResourceLoadedAtClient_internal = 2,
  removeAnimation = 2,
  requestLODsClient = 16,
  requestModSizes = 2
}

 

 INFO: {
  ["Inventory->checkWeapons"] = 3,
  aPlayerVersion = 1,
  boneAttach_requestAttachmentData = 1,
  driveby_clientScriptLoaded = 2,
  getElementItems = 1,
  ["loader.onload"] = 1,
  onAccountLoadData = 1,
  onAskForBubbleSettings = 2,
  onClientSync = 3,
  onElementDataChange = 228,
  onElementDestroy = 2,
  onElementModelChange = 1,
  onOpenGui = 2,
  onPlayerClick = 8,
  onPlayerCommand = 1,
  onPlayerConnect = 2,
  onPlayerJoin = 2,
  onPlayerLogin = 1,
  onPlayerMoneyChange = 1,
  onPlayerRequestLogin = 1,
  onPlayerSpawn = 2,
  onResourcePreStart = 1,
  onResourceStart = 1,
  onResourceStop = 1,
  removeAnimation = 4,
  removeJoin = 1,
  requestLODsClient = 15,
  requestModSizes = 1
}

 INFO: {
  GGbindMouseRoll = 1,
  addVoice = 3,
  onColShapeLeave = 4,
  onConsole = 10,
  onDebugMessage = 3,
  onElementColShapeLeave = 4,
  onElementDataChange = 15251,
  onElementDestroy = 4,
  onElementStartSync = 1,
  onMarkerHit = 4,
  onMarkerLeave = 4,
  onPlayerChat = 1,
  onPlayerCommand = 11,
  onPlayerContact = 7,
  onPlayerDamage = 4,
  onPlayerMarkerHit = 4,
  onPlayerMarkerLeave = 4,
  onPlayerMoneyChange = 1,
  onPlayerTarget = 71,
  onPlayerVoiceStart = 3,
  onPlayerVoiceStop = 3,
  onPlayerWeaponSwitch = 1,
  onVehicleDamage = 20,
  removeAnimation = 9,
  removeVoice = 3
}

 INFO: {
  GGbindMouseRoll = 4,
  ["Inventory->checkWeapons"] = 1,
  aPermissions = 1,
  aPlayerVersion = 1,
  addVoice = 1,
  boneAttach_requestAttachmentData = 1,
  driveby_clientScriptLoaded = 1,
  getElementItems = 1,
  onAskForBubbleSettings = 1,
  onClientSync = 2,
  onColShapeLeave = 2,
  onConsole = 11,
  onDebugMessage = 5,
  onElementColShapeLeave = 2,
  onElementDataChange = 15213,
  onElementDestroy = 6,
  onElementStartSync = 1,
  onElementStopSync = 1,
  onMarkerHit = 3,
  onMarkerLeave = 2,
  onNotifyTargetEnabled = 1,
  onOpenGui = 1,
  onPlayerClick = 2,
  onPlayerCommand = 11,
  onPlayerContact = 5,
  onPlayerDamage = 10,
  onPlayerMarkerHit = 3,
  onPlayerMarkerLeave = 2,
  onPlayerMoneyChange = 2,
  onPlayerNetworkStatus = 2,
  onPlayerTarget = 106,
  onPlayerVehicleEnter = 1,
  onPlayerVehicleExit = 1,
  onPlayerVoiceStart = 1,
  onPlayerVoiceStop = 1,
  onPlayerWeaponSwitch = 2,
  onResourceLoadedAtClient_internal = 1,
  onVehicleDamage = 1,
  onVehicleEnter = 1,
  onVehicleExit = 1,
  onVehicleStartEnter = 1,
  onVehicleStartExit = 1,
  removeAnimation = 29,
  removeVoice = 1,
  requestLODsClient = 15,
  sendBugMessageToAdmins = 1
}
[19-08-03 23:32:25] INFO: {
  ClicarJogador = 6,
  ClickJogadorCurar = 6,
  ["DNL:Reparar"] = 1,
  GGbindMouseRoll = 1,
  addVoice = 1,
  ggun_take = 1,
  onChatMessage = 1,
  onColShapeHit = 1,
  onColShapeLeave = 2,
  onConsole = 15,
  onElementClicked = 13,
  onElementColShapeHit = 1,
  onElementColShapeLeave = 2,
  onElementDataChange = 13834,
  onElementDestroy = 5,
  onMarkerHit = 3,
  onMarkerLeave = 1,
  onPlayerChat = 2,
  onPlayerClick = 14,
  onPlayerCommand = 17,
  onPlayerContact = 4,
  onPlayerDamage = 1,
  onPlayerMarkerHit = 3,
  onPlayerMarkerLeave = 1,
  onPlayerMoneyChange = 1,
  onPlayerTarget = 42,
  onPlayerVoiceStart = 1,
  onPlayerWeaponSwitch = 3,
  onVehicleDamage = 2,
  removeAnimation = 23,
  removeVoice = 1
}
[19-08-03 23:32:35] INFO: {
  GGbindMouseRoll = 1,
  addVoice = 2,
  boneAttach_requestAttachmentData = 1,
  ggun_drop = 1,
  onColShapeLeave = 2,
  onConsole = 4,
  onElementColShapeLeave = 2,
  onElementDataChange = 15240,
  onElementDestroy = 9,
  onMarkerHit = 3,
  onMarkerLeave = 2,
  onPlayerChat = 3,
  onPlayerCommand = 7,
  onPlayerMarkerHit = 3,
  onPlayerMarkerLeave = 2,
  onPlayerMoneyChange = 1,
  onPlayerTarget = 40,
  onPlayerVehicleEnter = 1,
  onPlayerVoiceStart = 1,
  onPlayerVoiceStop = 2,
  onPlayerWeaponSwitch = 1,
  onVehicleEnter = 1,
  onVehicleStartEnter = 1,
  removeAnimation = 7,
  removeVoice = 2,
  requestLODsClient = 1,
  requestModSizes = 1
}
[19-08-03 23:32:45] INFO: {
  GGbindMouseRoll = 1,
  ["lspd:toggleFlashers"] = 1,
  onColShapeLeave = 1,
  onConsole = 4,
  onElementColShapeLeave = 1,
  onElementDataChange = 18725,
  onElementDestroy = 6,
  onElementStartSync = 1,
  onMarkerHit = 3,
  onMarkerLeave = 1,
  onPlayerChat = 1,
  onPlayerCommand = 5,
  onPlayerContact = 7,
  onPlayerDamage = 1,
  onPlayerMarkerHit = 3,
  onPlayerMarkerLeave = 1,
  onPlayerMoneyChange = 3,
  onPlayerTarget = 20,
  onPlayerWeaponSwitch = 1,
  removeAnimation = 5,
  sendBugMessageToAdmins = 1
}

 

[19-08-03 23:39:45] INFO: {
  SirenSinc = 2,
  addVoice = 4,
  engineswitch = 1,
  onAccountDataChange = 82,
  onAccountSaveData = 1,
  onChatMessage = 1,
  onColShapeLeave = 5,
  onConsole = 4,
  onDebugMessage = 3,
  onElementColShapeLeave = 5,
  onElementDataChange = 17792,
  onElementDestroy = 10,
  onElementStartSync = 1,
  onElementStopSync = 1,
  onMarkerHit = 6,
  onMarkerLeave = 3,
  onPickupHit = 2,
  onPickupSpawn = 2,
  onPickupUse = 2,
  onPlayerChat = 1,
  onPlayerCommand = 5,
  onPlayerContact = 7,
  onPlayerMarkerHit = 6,
  onPlayerMarkerLeave = 3,
  onPlayerMoneyChange = 3,
  onPlayerPickupHit = 2,
  onPlayerPickupUse = 2,
  onPlayerQuit = 1,
  onPlayerTarget = 23,
  onPlayerVoiceStart = 3,
  onPlayerVoiceStop = 2,
  onResourcePreStart = 1,
  onResourceStart = 1,
  onVehicleDamage = 1,
  removeAnimation = 12,
  removeVoice = 2
}

[19-08-03 23:39:25] INFO: {
  GGbindMouseRoll = 1,
  ["Inventory->checkWeapons"] = 1,
  getElementItems = 1,
  onAccountLoadData = 1,
  onColShapeLeave = 5,
  onConsole = 5,
  onDebugMessage = 1,
  onElementColShapeLeave = 5,
  onElementDataChange = 19477,
  onElementDestroy = 59,
  onElementModelChange = 1,
  onElementStartSync = 2,
  onElementStopSync = 2,
  onMarkerHit = 14,
  onMarkerLeave = 5,
  onPlayerClick = 4,
  onPlayerCommand = 5,
  onPlayerContact = 6,
  onPlayerDamage = 1,
  onPlayerLogin = 1,
  onPlayerMarkerHit = 8,
  onPlayerMarkerLeave = 5,
  onPlayerMoneyChange = 4,
  onPlayerRequestLogin = 1,
  onPlayerTarget = 15,
  removeAnimation = 7
}
[19-08-03 23:39:35] INFO: {
  ["DNL:Reparar"] = 1,
  GGbindMouseRoll = 11,
  SirenSinc = 2,
  addVoice = 2,
  onChatMessage = 1,
  onColShapeLeave = 5,
  onConsole = 8,
  onElementClicked = 2,
  onElementColShapeLeave = 5,
  onElementDataChange = 20232,
  onElementDestroy = 7,
  onElementStartSync = 1,
  onElementStopSync = 1,
  onMarkerHit = 9,
  onMarkerLeave = 5,
  onPlayerClick = 6,
  onPlayerCommand = 8,
  onPlayerContact = 8,
  onPlayerMarkerHit = 8,
  onPlayerMarkerLeave = 5,
  onPlayerMoneyChange = 2,
  onPlayerTarget = 33,
  onPlayerVoiceStart = 2,
  onPlayerVoiceStop = 2,
  onPlayerWeaponSwitch = 2,
  removeAnimation = 17,
  removeVoice = 2
}

 

 

 

Link to comment
On 04/08/2019 at 11:33, MrTasty said:

local eventList = {}

setTimer(
  function () 
    if next(eventList) then
      outputDebugString(inspect(eventList))
      eventList = {}
    end
  end, 10000, 0
)


addDebugHook( "preEvent", 
  function ( sourceResource, eventName, eventSource, eventClient, luaFilename, luaLineNumber, ... )
    local i = inspect(sourceResource).."/"..eventName.."/"..inspect(eventSource)
    eventList[i] = (eventList[i] and eventList[i] + 1) or 1
  end, "onElementDataChange"
)

You could use this slightly adapted IIYAMA's code (only hooking onto onElementDataChange this time) which also includes the name of the resource and a readable identifier for the source element into the list, so you can tell which resource causes the large amount of data changes.

Just use this code @juaosilv

Edited by N3xT
Link to comment
  • Moderators
15 hours ago, IIYAMA said:

At first yes you would expect that.

But there is one thing that isn't taken in account.

If one of the other clients does this:


setElementData(root, ":O", false, false)

 

In that case, even if the value doesn't change, the value of this specific client must be updated. With other words it does not matter if the value is the same. All clients their value must be forced to set to the last known value.

 

 I don't know if the event is fired or not. But it is just as bad for the network.

 

 

Yeah.

I actually asked this because I was wondering how MTA handles internally element-data where the old value is the same as the new... (may have some verification for the sake of performance).

As for the on(client)ElementDataChange, it only fires when the new value is different from the old one.

  • Like 1
Link to comment
  • Moderators
1 hour ago, DNL291 said:

Yeah.

I actually asked this because I was wondering how MTA handles internally element-data where the old value is the same as the new... (may have some verification for the sake of performance).

To be honest I have no idea. I more or less just do some experiments and see what will happens. Including observing the context and possible situations. But not reading the source code, yes, shame on me.

 

(Verification is not possible to implement in MTA, as that would mean that it would create de-sync or more network usage.) That conclusion is just based on conditional reasoning, which is also a bad habit of mine.

 


Every message counts! :protest:

if getElementData(root, ":O") ~=  true then
  setElementData(root, ":O", true)
end

 


 

 

Would this wrapper make people think more about what it means to enable synchronize argument?  :idea: Or creating more confusing? (lots of old resources will break after applying this...)

do
	local setElementData_ = setElementData
	function setElementData(element, key, value, synchronize)
		if synchronize == nil then
			synchronize = false
		end
		return setElementData_(element, key, value, synchronize)
	end
end

 

Old syntax:

bool setElementData ( element theElement, string key, var value [, bool synchronize = true ] )

New syntax:

bool setElementData ( element theElement, string key, var value [, bool synchronize = false ] )

 


ohhh, st:whax:p ](*,)t

do
	local setElementData_ = setElementData
	function setElementData(element, key, value, synchronize)
		if synchronize == nil then
			synchronize = false
		end
		return getElementData(element, key) ~= value and setElementData_(element, key, value, synchronize) or false
	end
end

 

 

 

 

 

If we want to get rid of this whole issue:

-- clientside
setElementDataStreamEnabled(element, state)

-- true < receiving elementdata updates from the server for this element.

But it might be too late for applying something as big as that, in this stage of the development.

 

 

 

 

Edited by IIYAMA
  • Like 1
Link to comment
18 hours ago, IIYAMA said:

?

Afk you do not have to modify anything. Copy > past > run

I sent all the log data in your private, there you can see the data they gave. With 15-20 the server started to slow down and crashing, I did not send here because it contains data from my users.

 

@MrTasty I sent it in your Private too.

 

Edit: Console logs: https://pastebin.com/jGc5AVvw

Edited by juaosilv
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...