ACE3 icon indicating copy to clipboard operation
ACE3 copied to clipboard

ace_rearm_fnc_addVehicleMagazinesToSupply returns error and nearly killing game (1FPS)

Open MAD-BUG opened this issue 8 years ago • 11 comments

Arma 3 Version: 1.80 (stable) CBA Version: 3.6.1 (stable) ACE3 Version: 3.12.1 (stable)

Mods:

- CBA_A3
- ace

Description: With ace_rearm_supply = 2 and adding function ace_rearm_fnc_addVehicleMagazinesToSupply to supply vehicle popups script error in line 6: Error allTurrets: Type String, expected Array, Object

Steps to reproduce:

  • Add supply vehicle and combat vehiclel like tank.
  • Give appropriate variable names to use in script
  • Add [ammo_truck, tank] call ace_rearm_fnc_addVehicleMagazinesToSupply; to supply vehicle
  • Start into singleplayer mission test and see a pop up of script error and huge freezes.

Where did the issue occur?

  • Editor (Singleplayer) / Editor (Multiplayer)

RPT log file: ACE Debug: https://pastebin.com/9ssgpTw1 RPT: https://drive.google.com/open?id=1d0Ful53nQLvrCyW3Shn5iw4GSU00TR5c

MAD-BUG avatar Mar 26 '18 20:03 MAD-BUG

Needs RPT file.

commy2 avatar Mar 26 '18 22:03 commy2

https://github.com/acemod/ACE3/blob/0644ad9ca2fadd28711dd614be296542a834bc3e/addons/rearm/functions/fnc_getAllRearmTurrets.sqf Called with a string. params should probably verify.

https://github.com/acemod/ACE3/blob/0644ad9ca2fadd28711dd614be296542a834bc3e/addons/rearm/functions/fnc_addVehicleMagazinesToSupply.sqf#L28 makes sure a string is passed. But we only accept object.

https://github.com/acemod/ACE3/blob/0644ad9ca2fadd28711dd614be296542a834bc3e/addons/rearm/functions/fnc_getAllRearmTurrets.sqf#L9

There is no allTurrets syntax that takes a classname.

Caused by: #5411 https://github.com/acemod/ACE3/pull/5411/files#diff-1e207afbf4490e7eaed71d2ae790c4ffR32

dedmen avatar Mar 27 '18 07:03 dedmen

Added RPT but it is 7MB of spam.

MAD-BUG avatar Mar 27 '18 18:03 MAD-BUG

[ACE] (ui) INFO: Attempted modification of a forced User Interface element 'ammocount' by 'ace_reload'. Spam indeed. WTF happened to your Arma :D But the RPT doesn't help much anyway. Already found the error.

dedmen avatar Mar 27 '18 20:03 dedmen

Weird mission? What happens on an empty mission.

commy2 avatar Mar 27 '18 20:03 commy2

Can you explain your post in more detail, dedmen?

commy2 avatar Mar 27 '18 20:03 commy2

What more detail? addVehicleMagazinesToSupply forces _vehicle variable to contain the classname. and calls getAllRearmTurrets with that classname. But getAllRearmTurrets only accepts object as parameter. Simple case of passing the wrong parameter type.

addVehicleMagazinesToSupply https://github.com/acemod/ACE3/blob/0644ad9ca2fadd28711dd614be296542a834bc3e/addons/rearm/functions/fnc_addVehicleMagazinesToSupply.sqf#L7 We just cannot accept string here. And remove the https://github.com/acemod/ACE3/blob/0644ad9ca2fadd28711dd614be296542a834bc3e/addons/rearm/functions/fnc_addVehicleMagazinesToSupply.sqf#L28-L31

dedmen avatar Mar 28 '18 07:03 dedmen

I wonder what causing so much spam in RPT and such low FPS in what looks like a simple script error.

MAD-BUG avatar Mar 28 '18 16:03 MAD-BUG

The error is not what's causing your RPT spam.

dedmen avatar Mar 28 '18 17:03 dedmen

But it is. At least i got it every time, i am doing repro written above.

MAD-BUG avatar Mar 28 '18 18:03 MAD-BUG

Because the function is running in the EGVAR(common,runAtSettingsInitialized) pushBack array, when the error happens it breaks the entire loop and keeps re-running the init chain each time.

Can reproduce by just doing

["CBA_settingsInitialized", {diag_log "here"; allTurrets "x"}] call cba_fnc_addEventHandler;

and it will spam forever. Code that goes into execNextFrame needs to be error free.

PabstMirror avatar Apr 02 '18 06:04 PabstMirror