" or LUA scripts I have written that are doing the same. "
---
None of your lua scripts do that (monitor anything), your triggers (monitoring what's in\or not a given area, or detecting) setup do though behinds the scenes though. The only problem I saw in your actual scripts is using global vars instead of local ones ('a = blabla' instead of 'local a = blabla'), and many of the scripts I eyeballed are acting upon objects without checking if they exist first (adding mags, helo's etc to things) which may or may not be ok given their execution context (which I didn't determinate for all when looking). The lua scripts involved are very simple, not recurring or recursive, and don't appear at a glace as the core of whatever is going on, but actions could be related to timing of when problems start happening.
I would recommend _looking at your logs_ when the slow down starts to see what if anything is going on, both activity wise in the game log, and any repeating errors that might be happening (be they from the game or the scripts) in the game error or script error logs.
For example.. on startup there are errors generated and on my system (about sides,weapons, and units not found that scripts are trying to act against).
The errors throw during on-scenario-load regardless:
Code: Select all
8/6/2023 3:55:34 PM -- B1307.19 -- Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index -- Scen : Puget Sound Environment -- DB : --
Exception: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Stack Trace: at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at DtrRowCollection.get_Item(Int32 i)
at Command_Core.DAL.DBFunctions.GetWeapon(SQLiteConnection theConn, Weapon theWeapon, Int32 WeaponDBID, Scenario theScen, Boolean LoadComponents)
Call Stack & Error details:
Error at 200274, Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
lua log:
Function:ScenEdit_AddUnit (0) Error:Side not found
Function:ScenEdit_AssignUnitToMission (0) Error:UnitX was not found in the scenario unit list!
Function:ScenEdit_AddUnit (0) Error:Side not found
Function:ScenEdit_AssignUnitToMission (0) Error:UnitX was not found in the scenario unit list!
Function:ScenEdit_AddUnit (0) Error:Side not found
Those may or may not be harmless overall
Then at around ~03:12-03:13Z (I pressed play and 15x and just let the game run) game basically halts with thousands of parallel-task errors getting logged (log went from a few dozen lines to 21meg in a few seconds):
The event that happens in game just prior to it locking up for me twice is:
"SH-60F Ocean Hawk - Determined as: Neutral (Classification by: Partridge Bank Lighted Buoy [Sensor: Mk1 Eyeball] at Estimated 2 nm)" in 2 of my attempts on a clean restart playing at 15x.
Followed by the following exceptions:
Code: Select all
8/6/2023 3:34:10 PM -- B1307.19 -- One or more errors occurred. -- Scen : Puget Sound Environment -- DB : --
Exception: One or more errors occurred.
Stack Trace: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IList`1 list, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, Action`1 body)
at Command_Core.GameGeneral._Closure$__118-0._Lambda$__2(Side theSide)
Inner Exception: Object reference not set to an instance of an object.
Inner StackTrace: at Command_Core.GameGeneral._Closure$__118-2._Lambda$__3(Contact theC)
at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)
at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)
Call Stack & Error details:
Error at 101293,
But those didn't happen when playing at 5x. *shrugs*.
Other exceptions seen at points in time playing at 5x...(play 5x gets me past whatever goes on around 3:-12\13 at 15x).
They seem to occur every few seconds at do not appear to be lua generated but but behind the scenes exceptions.
Code: Select all
8/6/2023 4:10:17 PM -- B1307.19 -- Object reference not set to an instance of an object. -- Scen : Puget Sound Environment -- DB : --
Exception: Object reference not set to an instance of an object.
Stack Trace: at Command_Core.Weapon.IsNominallySuitableForThisTarget(Scenario theScen, Contact& theTarget, Nullable`1& TargetIsDestroyed)
Call Stack & Error details:
Error at 200276, Object reference not set to an instance of an object.
Now as too the pluse time freakout after awhile (for me anywhere from 12min to 26min, but more often around 26min), when things goto crap pluse time wise for me. When this happens you will see (or I do see) the follow taken in the exception logs, there are like hundreds of duplicate entries per second when it happens and this is what is taking the extra pulse time (all the writing to the logs):
Code: Select all
8/6/2023 4:18:55 PM -- B1307.19 -- Index was outside the bounds of the array. -- Scen : Puget Sound Environment -- DB : --
Exception: Index was outside the bounds of the array.
Stack Trace: at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at System.Collections.ObjectModel.ObservableDictionary`2.Add(TKey key, TValue value)
at Command_Core.ActiveUnit_AI.TargetThisContact(Contact theContact, Boolean AddedManually, Boolean PriorityTarget, _TargetingBehavior TargetingBehavior)
Call Stack & Error details:
Error at 100041,
Evironment: Runs were under build 1307.19, in editor mode, on an ancient srv2008r2 system,command.exe changed to normal priority while at main menu each time, before entering editor and loading and playing scene.
TLDR: Probably needs a dev to open this scene up and press play and monitor it at 5x or 15x till the ~30min mark to see what is actually causing the exceptions.
That said the scene rarely doesn't hang (and I mean stop progressing, actual exe is still responsive enough to exit) for me entirely at some point regardless of 15x or 5x, in fact in 6 attempts in the editor I only once got to 30min mark without a hard stop of time. Most of the time the log indicated the problems but, twice it just hung with no repeated errors in the log. Not sure any of this helps at all other then to say there are problems and often though not always you can see it in the logs while playing, and I don't think there is anything really wrong with your scripts - but they may be involved in the specific timing of when other underlying errors present themselves.