[OneSync] OneSync events shadow triggering on client-side only scripts


Operating system: Ubuntu 20.04.1 LTS
Artifact version: 2949
IP address: fivem.pmarp.com
Resources: 120+
System specifications: AMD Ryzen 7 3800X 8-Core Processor


Summary: OneSync events are triggering in resources where there are no event handlers for them (entityCreated, playerEnteredScope, playerLeftScope, etc.)
Steps to reproduce: Oddly enough the only way to make it cause massive issues is going over 100+ players, in which after it goes over 100 players there will be massive network sync issues which cause the server to be briefly unplayable.
Error screenshot (if any): https://i.imgur.com/1gvaNEh.png


So after some more testing tonight it’s not specifically OneSync events it’s any event. The events are triggering ONLY on client side only files (ones that don’t specify a server.lua) I’m going to try to specify a empty server.lua to see if this resolves the issue and will keep this posted.

Just a note for the screen shot above, all of the small yellow ticks are playerEnteredScope events.

This happens on my end too, not sure whether that intended or not.

Odd - a resource should typically have to explicitly register as an event handler. If no server-side scripts exist there’s not even any ScRT for that resource so this might be a profiler anomaly instead?

The callback (on ResourceEventComponent) that determines whether a Resource handles an event should be at a lower order, and returning false in this case, than the callbacks that generate profiler trace events. Even if the profiler is enabled, trace events should not be generated for those resources.

Given that there is no ScRT there are only a few potential areas for testing.


As expected, https://github.com/citizenfx/fivem/blob/master/code/components/citizen-scripting-core/src/ResourceScriptingComponent.cpp#L113 doesn’t create the environment (and event callbacks) that preempt OnTriggerEvent, so profiler events will always be generated for no ScRT resources.

This is mainly a profiler anomaly. Although, I suppose the profiler and ServerWatchdog could be cleaned up for such cases.

That’s odd then, I’ll try and fill you in later today when we hit 100+ and try and to provide more information to see if this is actually the case. But if it is I’m even more stumbled to why we get massive network issues when going 90-120~ players.

Thank you both for your response, We’ve figured out that actual network thread hitching was not a FiveM problem and looks to be an issue with iptables and our firewall. I’m sorry for taking up y’alls time and thank you for your willingness to help.