KSP-KOS / KOS

Fully programmable autopilot mod for KSP. Originally By Nivekk
Other
697 stars 230 forks source link

About last version of KOS & KPM Test report #2888

Open Massetstephane opened 3 years ago

Massetstephane commented 3 years ago

HI ! I conducted some test with the new version kOSPropMonitor-1.7.2.29290 & kOS-v1.3.2.0 I'm working on a stock installation by adding as and when KOS - KPM So I launched a first time without my script folder. in log we have this : [EXC 11:15:08.036] ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0) System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0) kOS.Screen.Interpreter.IsWaitingForCommand () (at <3ccb18ebae2a49929054690a1a176760>:0) kOS.Screen.TermWindow.ProcessUnconsumedInput () (at <3ccb18ebae2a49929054690a1a176760>:0) kOS.Screen.TermWindow.Update () (at <3ccb18ebae2a49929054690a1a176760>:0) UnityEngine.DebugLogHandler:LogException(Exception, Object) ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object) UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object) But it's work ! (button label, with my library it's perfect added after the first test) And I know why at starting the buttons of the mfd does not work at the first start, the default page of the monitor mfdKOS does not have the handler page with Kosmonitor, so when the script in Boot launches addons:KPM is not taken into account.

It's OK . (I'll have to choose between two option a single page on the MFDKOS or not use addons:kpm in the script boot.) steph.

Dunbaratu commented 3 years ago

I literally have no idea what I'm supposed to do with this information.

Massetstephane commented 3 years ago

hi ! sorry !! Ah yes forgot the log file, in fact i have this message error but is not a problem for now. For my page problem it's KPM concerned not kos. I'm going to give back a log file. Steph. last version . KOS & KPM KSP.log

JonnyOThan commented 3 years ago

FWIW I've seen this same exception when not using KPM, but I don't have a good repro case. I'll keep an eye out for it.

Massetstephane commented 3 years ago

@JonnyOThan , ok . I don't know if has an impact on the game, I would have to play a game for good, I spend more time tampering with KSP than doing games. I have a save (career) well advanced in 1.10 but with a lot of Mod not yet compatible in 1.11.1

StoneBlue commented 3 years ago

I am also seeing this same exact stream of exceptions upon craft launch from the editor. WITHOUT, having kOS Prop Monitor ever installed.

Heres link to my forum post on the thread about it, with links to log and gamedata screenshot: https://forum.kerbalspaceprogram.com/index.php?/topic/165628-ksp-1101-and-111-kos-v1310-kos-scriptable-autopilot-system/&do=findComment&comment=3940645

Dunbaratu commented 3 years ago

Sigh. It doesn't appear on my install, which means it might be a race condition that only happens if the startup callback hooks happen in a particular order. (Something trying to start running its Update() logic before all the pieces it needs have finished loading in.) I hope not. Those are darn near impossible to diagnose.

Does the exception only happen once when you first launch the vessel, or does it keep spamming the log multiple times a second?

StoneBlue commented 3 years ago

Once, immediately... but a constant burst, that lasts maybe 5~10 seconds, then stops. I get exceptions from other mods interspersed during this time, that seem related, which I dont get without a kOS part attached. I'll test further on a fresher install, with less mods installed.. not that there's that many now.

mgalyean commented 3 years ago

I get a very similar stream of errors, fwiw. Seems mostly harmless in the contextual soup of unity/mono/ksp bad index, null object, not found errors. Though I am convinced that if the devs involved found ways to avoid generating these errors the dynamic state of the game would be far more stable. A null object reference can only happen under certain circumstances and all of them are avoidable and avoiding them is desirable as relying of underlying corner-case error trapping is never a good idea as it almost certainly was not tested a well as the main pathways and it is in those corners that testing doesn't travel to much that slow memory leaks and conditional segmentation errors lurk. Ok, off soap box. But did want to mention that I get a very similar string of errors and do not have KPM installed, but do have RPM installed. So maybe it is RPM related as I assume OP has that installed if OP had KPM installed

Dunbaratu commented 3 years ago

Alright, even though I can't make the error show up, I can tell from the stack trace you posted that there's really only one possible line that could be throwing that particular exception, and it's this one:

https://github.com/KSP-KOS/KOS/blob/69c8425a8f8db05845b5ed5ae5245ff4edc8b525/src/kOS/Screen/Interpreter.cs#L165

The index out of range has to be coming from context.InstructionPointer being out of range for the context.Program array.

If you have access to a dev environment to compile kOS, you could try putting a debug logging line just before that line to print out what is context.Program.Count() and what is context.InstructionPointer just before the return line.

It's possible something is trying to start up here before the context.Program has been initialized, and thus it has zero items in it (such that any value of context.InstructionPointer would be out of range.)