Page MenuHomeFeedback Tracker

fn_initModules creates a group for each cfgfactionclasses
New, NormalPublic

Description

I recently noted I'm getting some errors (a lot of them, 8mb in an hour) in the server RPT.

22:21:16 Tried to create group while group limit is reached on side Game Logic
22:21:16  ➥ Context:    [] L31 (/temp/bin/A3/Functions_F/Modules/fn_initModules.sqf)
    [] L19 (/temp/bin/A3/Functions_F/Modules/fn_initModules.sqf)
    [] L22 (/temp/bin/A3/Functions_F/Modules/fn_initModules.sqf)
    [] L23 (/temp/bin/A3/Functions_F/Modules/fn_initModules.sqf)

I'm trying to work out why initModules makes a group for each of the cfgfactionclasses? With our modset loaded that's 234 groups it's made before any placed modules or other things try to make any sideLogic groups. I assume this error comes because we're hitting the 288 limit on groups for sideLogic.

Snippet from fn_initModules

_sideLogic = sidelogic call bis_fnc_sideID;
{
    _category = configname _x;
    _side = getnumber (_x >> "side");
    if (_side == _sideLogic) then {
        _groupVar = "bis_fnc_initModules_" + _category;
        _group = grpnull;
        if (isserver) then {
            _group = creategroup sidelogic;
            missionnamespace setvariable [_groupVar,_group];
            publicvariable _groupVar;
        } else {
            _group = missionnamespace getvariable [_groupVar,grpnull]
        };
        _group setgroupid [gettext (configfile >> "cfgfactionclasses" >> _category >> "displayname")];
    };
} foreach ((configfile >> "cfgfactionclasses") call bis_fnc_returnchildren);

I'm not sure why it does this by default but with large modsets (that add factionClasses) you'll hit the group limit fairly quickly, especially if you place modules in the mission.sqm (as we do).

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce

This is a bit hard to reproduce without making a mod that adds a bunch of faction classes. You can simulate it a bit if you've got a lot of mods loaded:

// Simulate fn_initModules
biGrps = [];
{
    private _group = creategroup sidelogic;
    biGrps pushback _group;
} foreach ((configfile >> "cfgfactionclasses") call bis_fnc_returnchildren);

// Simulate someone placing lots of modules
myGrps = [];
for "-" from 0 to 99 do {
    private _group = creategroup sidelogic;
    myGrps pushback _group;
};

diag_log format ["Simulated fn_initModules groups: %1", count biGrps];
diag_log format ["Simulated module groups: %1", count myGrps];
diag_log format ["Total groups created: %1 / 288", count (myGrps + biGrps)];
Additional Information

I've dumped out a list of our factionClasses here. Also allGroups doesn't display sideLogic groups making this really hard to debug/understand what's happening!

[bin\config.bin/CfgFactionClasses/Default,
bin\config.bin/CfgFactionClasses/usm_usarmy,
bin\config.bin/CfgFactionClasses/usm_usmarinecorps,
bin\config.bin/CfgFactionClasses/usm_usnavy,
bin\config.bin/CfgFactionClasses/usm_usairforce,
bin\config.bin/CfgFactionClasses/NO_CATEGORY,
bin\config.bin/CfgFactionClasses/LSR,
bin\config.bin/CfgFactionClasses/BLU_F,
bin\config.bin/CfgFactionClasses/OPF_F,
bin\config.bin/CfgFactionClasses/IND_F,
bin\config.bin/CfgFactionClasses/IND_G_F,
bin\config.bin/CfgFactionClasses/CIV_F,
bin\config.bin/CfgFactionClasses/BLU_G_F,
bin\config.bin/CfgFactionClasses/OPF_G_F,
bin\config.bin/CfgFactionClasses/Ambient,
bin\config.bin/CfgFactionClasses/Events,
bin\config.bin/CfgFactionClasses/Intel,
bin\config.bin/CfgFactionClasses/ObjectModifiers,
bin\config.bin/CfgFactionClasses/GroupModifiers,
bin\config.bin/CfgFactionClasses/StrategicMap,
bin\config.bin/CfgFactionClasses/Sites,
bin\config.bin/CfgFactionClasses/Supports,
bin\config.bin/CfgFactionClasses/Effects,
bin\config.bin/CfgFactionClasses/Modes,
bin\config.bin/CfgFactionClasses/Multiplayer,
bin\config.bin/CfgFactionClasses/None,
bin\config.bin/CfgFactionClasses/KeyframeAnimation,
bin\config.bin/CfgFactionClasses/FiringDrills,
bin\config.bin/CfgFactionClasses/mbg_bugs_faction,
bin\config.bin/CfgFactionClasses/Virtual_F,
bin\config.bin/CfgFactionClasses/Interactive_F,
bin\config.bin/CfgFactionClasses/Objectives,
bin\config.bin/CfgFactionClasses/Curator,
bin\config.bin/CfgFactionClasses/Ordnance,
bin\config.bin/CfgFactionClasses/SmokeShells,
bin\config.bin/CfgFactionClasses/Chemlights,
bin\config.bin/CfgFactionClasses/Flares,
bin\config.bin/CfgFactionClasses/Respawn,
bin\config.bin/CfgFactionClasses/Animals,
bin\config.bin/CfgFactionClasses/Audio,
bin\config.bin/CfgFactionClasses/Environment,
bin\config.bin/CfgFactionClasses/MissionFlow,
bin\config.bin/CfgFactionClasses/TimeTrials,
bin\config.bin/CfgFactionClasses/Training,
bin\config.bin/CfgFactionClasses/IND_C_F,
bin\config.bin/CfgFactionClasses/BLU_T_F,
bin\config.bin/CfgFactionClasses/BLU_CTRG_F,
bin\config.bin/CfgFactionClasses/BLU_GEN_F,
bin\config.bin/CfgFactionClasses/OPF_T_F,
bin\config.bin/CfgFactionClasses/OPF_V_F,
bin\config.bin/CfgFactionClasses/CombatPatrol,
bin\config.bin/CfgFactionClasses/CIV_IDAP_F,
bin\config.bin/CfgFactionClasses/Warlords,
bin\config.bin/CfgFactionClasses/IND_E_F,
bin\config.bin/CfgFactionClasses/IND_L_F,
bin\config.bin/CfgFactionClasses/BLU_W_F,
bin\config.bin/CfgFactionClasses/OPF_R_F,
bin\config.bin/CfgFactionClasses/Oldman,
bin\config.bin/CfgFactionClasses/OPF_GEN_F,
bin\config.bin/CfgFactionClasses/BLU_ION_lxWS,
bin\config.bin/CfgFactionClasses/IND_ION_lxWS,
bin\config.bin/CfgFactionClasses/OPF_ION_lxWS,
bin\config.bin/CfgFactionClasses/BLU_UN_lxWS,
bin\config.bin/CfgFactionClasses/IND_UN_lxWS,
bin\config.bin/CfgFactionClasses/BLU_NATO_lxWS,
bin\config.bin/CfgFactionClasses/IND_SFIA_lxWS,
bin\config.bin/CfgFactionClasses/OPF_SFIA_lxWS,
bin\config.bin/CfgFactionClasses/IND_TURA_lxWS,
bin\config.bin/CfgFactionClasses/BLU_TURA_lxWS,
bin\config.bin/CfgFactionClasses/OPF_TURA_lxWS,
bin\config.bin/CfgFactionClasses/gm_fc_bu,
bin\config.bin/CfgFactionClasses/gm_fc_bu_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_bu_civ,
bin\config.bin/CfgFactionClasses/gm_fc_cs,
bin\config.bin/CfgFactionClasses/gm_fc_cs_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_cs_civ,
bin\config.bin/CfgFactionClasses/gm_fc_gc,
bin\config.bin/CfgFactionClasses/gm_fc_gc_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_gc_civ,
bin\config.bin/CfgFactionClasses/gm_fc_hu,
bin\config.bin/CfgFactionClasses/gm_fc_hu_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_hu_civ,
bin\config.bin/CfgFactionClasses/gm_fc_pl,
bin\config.bin/CfgFactionClasses/gm_fc_pl_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_pl_civ,
bin\config.bin/CfgFactionClasses/gm_fc_ro,
bin\config.bin/CfgFactionClasses/gm_fc_ro_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_ro_civ,
bin\config.bin/CfgFactionClasses/gm_fc_ur,
bin\config.bin/CfgFactionClasses/gm_fc_ur_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_ur_civ,
bin\config.bin/CfgFactionClasses/gm_fc_be,
bin\config.bin/CfgFactionClasses/gm_fc_be_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_be_civ,
bin\config.bin/CfgFactionClasses/gm_fc_ca,
bin\config.bin/CfgFactionClasses/gm_fc_ca_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_ca_civ,
bin\config.bin/CfgFactionClasses/gm_fc_dk,
bin\config.bin/CfgFactionClasses/gm_fc_dk_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_dk_civ,
bin\config.bin/CfgFactionClasses/gm_fc_fr,
bin\config.bin/CfgFactionClasses/gm_fc_fr_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_fr_civ,
bin\config.bin/CfgFactionClasses/gm_fc_ic,
bin\config.bin/CfgFactionClasses/gm_fc_ic_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_ic_civ,
bin\config.bin/CfgFactionClasses/gm_fc_it,
bin\config.bin/CfgFactionClasses/gm_fc_it_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_it_civ,
bin\config.bin/CfgFactionClasses/gm_fc_lu,
bin\config.bin/CfgFactionClasses/gm_fc_lu_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_lu_civ,
bin\config.bin/CfgFactionClasses/gm_fc_nl,
bin\config.bin/CfgFactionClasses/gm_fc_nl_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_nl_civ,
bin\config.bin/CfgFactionClasses/gm_fc_no,
bin\config.bin/CfgFactionClasses/gm_fc_no_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_no_civ,
bin\config.bin/CfgFactionClasses/gm_fc_po,
bin\config.bin/CfgFactionClasses/gm_fc_po_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_po_civ,
bin\config.bin/CfgFactionClasses/gm_fc_uk,
bin\config.bin/CfgFactionClasses/gm_fc_uk_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_uk_civ,
bin\config.bin/CfgFactionClasses/gm_fc_us,
bin\config.bin/CfgFactionClasses/gm_fc_us_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_us_civ,
bin\config.bin/CfgFactionClasses/gm_fc_gr,
bin\config.bin/CfgFactionClasses/gm_fc_gr_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_gr_civ,
bin\config.bin/CfgFactionClasses/gm_fc_tu,
bin\config.bin/CfgFactionClasses/gm_fc_tu_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_tu_civ,
bin\config.bin/CfgFactionClasses/gm_fc_ge,
bin\config.bin/CfgFactionClasses/gm_fc_ge_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_ge_civ,
bin\config.bin/CfgFactionClasses/gm_fc_sp,
bin\config.bin/CfgFactionClasses/gm_fc_sp_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_sp_civ,
bin\config.bin/CfgFactionClasses/gm_fc_au,
bin\config.bin/CfgFactionClasses/gm_fc_au_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_au_civ,
bin\config.bin/CfgFactionClasses/gm_fc_sz,
bin\config.bin/CfgFactionClasses/gm_fc_sz_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_sz_civ,
bin\config.bin/CfgFactionClasses/gm_fc_fi,
bin\config.bin/CfgFactionClasses/gm_fc_fi_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_fi_civ,
bin\config.bin/CfgFactionClasses/gm_fc_sw,
bin\config.bin/CfgFactionClasses/gm_fc_sw_bgs,
bin\config.bin/CfgFactionClasses/gm_fc_sw_civ,
bin\config.bin/CfgFactionClasses/gmx_fc_cdf2022,
bin\config.bin/CfgFactionClasses/gmx_fc_cdf,
bin\config.bin/CfgFactionClasses/gmx_fc_chdkz,
bin\config.bin/CfgFactionClasses/gmx_fc_tak,
bin\config.bin/CfgFactionClasses/CBA_Modules,
bin\config.bin/CfgFactionClasses/ACE,
bin\config.bin/CfgFactionClasses/ACE_Logistics,
bin\config.bin/CfgFactionClasses/Admiral,
bin\config.bin/CfgFactionClasses/Admiral_Camps,
bin\config.bin/CfgFactionClasses/ARK,
bin\config.bin/CfgFactionClasses/Hull3,
bin\config.bin/CfgFactionClasses/ACE_missionModules,
bin\config.bin/CfgFactionClasses/CUP_B_USMC,
bin\config.bin/CfgFactionClasses/CUP_B_US_Army,
bin\config.bin/CfgFactionClasses/CUP_B_US_OFP,
bin\config.bin/CfgFactionClasses/CUP_B_CDF,
bin\config.bin/CfgFactionClasses/CUP_O_RU,
bin\config.bin/CfgFactionClasses/CUP_O_ChDKZ,
bin\config.bin/CfgFactionClasses/CUP_I_NAPA,
bin\config.bin/CfgFactionClasses/CUP_B_RNZN,
bin\config.bin/CfgFactionClasses/CUP_C_CHERNARUS,
bin\config.bin/CfgFactionClasses/CUP_C_RU,
bin\config.bin/CfgFactionClasses/CUP_C_SAHRANI,
bin\config.bin/CfgFactionClasses/CUP_O_TK,
bin\config.bin/CfgFactionClasses/CUP_O_TK_MILITIA,
bin\config.bin/CfgFactionClasses/CUP_C_TK,
bin\config.bin/CfgFactionClasses/CUP_C_Special,
bin\config.bin/CfgFactionClasses/CUP_B_US,
bin\config.bin/CfgFactionClasses/CUP_B_CZ,
bin\config.bin/CfgFactionClasses/CUP_B_GER,
bin\config.bin/CfgFactionClasses/CUP_I_TK_GUE,
bin\config.bin/CfgFactionClasses/CUP_I_UN,
bin\config.bin/CfgFactionClasses/CUP_O_SLA,
bin\config.bin/CfgFactionClasses/CUP_I_RACS,
bin\config.bin/CfgFactionClasses/CUP_B_GB,
bin\config.bin/CfgFactionClasses/CUP_I_PMC_ION,
bin\config.bin/CfgFactionClasses/CUP_B_HIL,
bin\config.bin/CfgFactionClasses/Rotor,
bin\config.bin/CfgFactionClasses/Rotor_Paths,
bin\config.bin/CfgFactionClasses/ace_zeus_AI,
bin\config.bin/CfgFactionClasses/ace_zeus_Captive,
bin\config.bin/CfgFactionClasses/ace_zeus_Medical,
bin\config.bin/CfgFactionClasses/ace_zeus_Repair,
bin\config.bin/CfgFactionClasses/ace_zeus_Utility,
bin\config.bin/CfgFactionClasses/ace_zeus_Arsenal,
bin\config.bin/CfgFactionClasses/acre_api_mission_setup,
bin\config.bin/CfgFactionClasses/MNP_MISC,
bin\config.bin/CfgFactionClasses/MNP_CH_UNI,
bin\config.bin/CfgFactionClasses/MNP_CH_WD,
bin\config.bin/CfgFactionClasses/MNP_CH_DE,
bin\config.bin/CfgFactionClasses/MNP_CH_MAR,
bin\config.bin/CfgFactionClasses/MNP_RU_VDV_DE,
bin\config.bin/CfgFactionClasses/MNP_KOR_OD,
bin\config.bin/CfgFactionClasses/MNP_KOR_WD,
bin\config.bin/CfgFactionClasses/MNP_IRN_RG,
bin\config.bin/CfgFactionClasses/MNP_IRN,
bin\config.bin/CfgFactionClasses/MNP_OPF_F_SN,
bin\config.bin/CfgFactionClasses/MNP_RU_AIR,
bin\config.bin/CfgFactionClasses/MNP_DPR_SUM,
bin\config.bin/CfgFactionClasses/MNP_DPR_AUT,
bin\config.bin/CfgFactionClasses/CUP_Static_Ships,
bin\config.bin/CfgFactionClasses/MNP_BLU_FC_Base,
bin\config.bin/CfgFactionClasses/MNP_CA_WD,
bin\config.bin/CfgFactionClasses/MNP_CA_DE,
bin\config.bin/CfgFactionClasses/MNP_AUS,
bin\config.bin/CfgFactionClasses/MNP_AMCU,
bin\config.bin/CfgFactionClasses/MNP_ROK,
bin\config.bin/CfgFactionClasses/MNP_USMCA_SN,
bin\config.bin/CfgFactionClasses/MNP_UKR,
bin\config.bin/CfgFactionClasses/MNP_ROK_SEAL,
bin\config.bin/CfgFactionClasses/MNP_IDF,
bin\config.bin/CfgFactionClasses/MNP_IRG_DE,
bin\config.bin/CfgFactionClasses/MNP_LVM_WD,
bin\config.bin/CfgFactionClasses/MNP_LVM_DE,
bin\config.bin/CfgFactionClasses/MNP_IRE_WD,
bin\config.bin/CfgFactionClasses/MNP_IRE_DE,
bin\config.bin/CfgFactionClasses/MNP_NZ,
bin\config.bin/CfgFactionClasses/MNP_FIN_WD,
bin\config.bin/CfgFactionClasses/MNP_FIN_SN,
bin\config.bin/CfgFactionClasses/MNP_NOR_WD,
bin\config.bin/CfgFactionClasses/MNP_NOR_DE,
bin\config.bin/CfgFactionClasses/ARK_NVA,
bin\config.bin/CfgFactionClasses/ARK_RU_CBRN]

Event Timeline

Cyruz created this task.Sep 26 2022, 1:14 PM
Cyruz edited Steps To Reproduce. (Show Details)Sep 26 2022, 1:30 PM
Cyruz edited Steps To Reproduce. (Show Details)Sep 26 2022, 1:32 PM
Cyruz edited Additional Information. (Show Details)Sep 26 2022, 1:34 PM
diwako added a subscriber: diwako.Sep 26 2022, 6:27 PM
Cyruz added a comment.Sep 27 2022, 4:51 PM

Thanks to @JonBons2020 think we've figured this out.

initModules is currently doing

if (isserver) then {
    _group = creategroup sidelogic;
    missionnamespace setvariable [_groupVar,_group];
    publicvariable _groupVar;
} else {
    _group = missionnamespace getvariable [_groupVar,grpnull]
};

Each time this runs, it creates a bunch more groups on sideLogic even if the existing groups are there. Changed the function to the below and it's not running out of groups anymore.

if (isserver && {isNull (missionnamespace getvariable [_groupVar, grpnull])}) then {
    _group = creategroup sidelogic;
    missionnamespace setvariable [_groupVar,_group];
    publicvariable _groupVar;
} else {
    _group = missionnamespace getvariable [_groupVar,grpnull]
};

Now checking to see if the group exists before creating another one each time.