Truinto / ONI-Modloader-SimpleMods

OxygenNotIncluded Mods
MIT License
17 stars 6 forks source link

[Piped Everything] Rare crash `Calculated an invalid temperature` #66

Open tekicode opened 1 month ago

tekicode commented 1 month ago

Describe the bug In occasional saves, I will encounter a crash involving Piped Everything, sometimes including mods like Fast Track. I managed to isolate a particular save (Tunnel, Cycle 901) involving a Rust Deoxidizer.

The error produced is:

Calculated an invalid temperature: t1=348.15, m1=0, t2=348.15, m2=0, min_temp=348.15, max_temp=348.15

  at UnityEngine.Debug.LogError (System.Object message) [0x00000] in <a83e096d0ba5413da59ce235b648c30c>:0 
  at Debug.LogError (System.Object obj) [0x00000] in <ca261bc4615d43b9981cc5be0c64ee95>:0 
  at GameUtil.GetFinalTemperature (System.Single t1, System.Single m1, System.Single t2, System.Single m2) [0x00000] in <93003a715e3b465790f3f0d0be0c331e>:0 
  at Storage.AddToPrimaryElement (SimHashes element, System.Single additional_mass, System.Single temperature) [0x00000] in <93003a715e3b465790f3f0d0be0c331e>:0 
  at ElementConverter.ElementConverter.ConvertMass_Patch0 (ElementConverter ) [0x00000] in <93003a715e3b465790f3f0d0be0c331e>:0 
  at ElementConverter+States+<>c.<InitializeStates>b__6_2 (ElementConverter+StatesInstance smi, System.Single dt) [0x00000] in <93003a715e3b465790f3f0d0be0c331e>:0 
  at BucketUpdater`1[DataType].Update (DataType data, System.Single dt) [0x00000] in <ca261bc4615d43b9981cc5be0c64ee95>:0 
  at UpdateBucketWithUpdater`1[DataType].Update (System.Single dt) [0x00000] in <ca261bc4615d43b9981cc5be0c64ee95>:0 
  at PeterHan.FastTrack.Metrics.StateMachineUpdater_Patch.UpdateAndReport (StateMachineUpdater+BaseUpdateBucket bucket, System.Single dt, StateMachineUpdater+BucketGroup group) [0x00000] in <ff6916707e9d43c3984481c8f2f85957>:0 
  at StateMachineUpdater+BucketGroup.StateMachineUpdater+BucketGroup.AdvanceOneSubTick_Patch0 (StateMachineUpdater+BucketGroup , System.Single ) [0x00000] in <ca261bc4615d43b9981cc5be0c64ee95>:0 
  at StateMachineUpdater.AdvanceOneSimSubTick () [0x00000] in <ca261bc4615d43b9981cc5be0c64ee95>:0 
  at Game.SimEveryTick (System.Single dt) [0x00000] in <93003a715e3b465790f3f0d0be0c331e>:0 
  at Game.Game.Update_Patch4 (Game ) [0x00000] in <93003a715e3b465790f3f0d0be0c331e>:0 
Build: U51-600112-S (FT-0.13.6.0)

Tunnel Cycle 901.sav.zip

Desktop (please complete the following information):

Additional context Issue occurs on this save even after disabling FastTrack, Stock Bug Fix, and other mods. I was able to recover from the bug by disconnecting and disabling the rust unit. If I figure anything else out I'll add this along.

The log I observed at the time, but unfortunately did not retain, mentioned Chlorine Gas. that's what made me hone in on the RDX unit.

m1/m2 being 0 makes me think the mass was somehow deleted on the output

tekicode commented 1 month ago

FYI the crash on the 901 save happens between 1/3rd to 1/2 the way through the cycle if the Rust unit is running and connected.

tekicode commented 1 month ago

Repeat occurrence, same save.

Calculated an invalid temperature: t1=366.5, m1=0, t2=366.5, m2=0, min_temp=366.5, max_temp=366.5

  at UnityEngine.Debug.LogError (System.Object message) [0x00000] in <a83e096d0ba5413da59ce235b648c30c>:0 
  at Debug.LogError (System.Object obj) [0x00000] in <ca261bc4615d43b9981cc5be0c64ee95>:0 
  at GameUtil.GetFinalTemperature (System.Single t1, System.Single m1, System.Single t2, System.Single m2) [0x00000] in <93003a715e3b465790f3f0d0be0c331e>:0 
  at Storage.AddToPrimaryElement (SimHashes element, System.Single additional_mass, System.Single temperature) [0x00000] in <93003a715e3b465790f3f0d0be0c331e>:0 
  at ElementConverter.ElementConverter.ConvertMass_Patch0 (ElementConverter ) [0x00000] in <93003a715e3b465790f3f0d0be0c331e>:0 
  at ElementConverter+States+<>c.<InitializeStates>b__6_2 (ElementConverter+StatesInstance smi, System.Single dt) [0x00000] in <93003a715e3b465790f3f0d0be0c331e>:0 
  at BucketUpdater`1[DataType].Update (DataType data, System.Single dt) [0x00000] in <ca261bc4615d43b9981cc5be0c64ee95>:0 
  at UpdateBucketWithUpdater`1[DataType].Update (System.Single dt) [0x00000] in <ca261bc4615d43b9981cc5be0c64ee95>:0 
  at StateMachineUpdater+BucketGroup.AdvanceOneSubTick (System.Single dt) [0x00000] in <ca261bc4615d43b9981cc5be0c64ee95>:0 
  at StateMachineUpdater.AdvanceOneSimSubTick () [0x00000] in <ca261bc4615d43b9981cc5be0c64ee95>:0 
  at Game.SimEveryTick (System.Single dt) [0x00000] in <93003a715e3b465790f3f0d0be0c331e>:0 
  at Game.Game.Update_Patch2 (Game ) [0x00000] in <93003a715e3b465790f3f0d0be0c331e>:0 
Build: U51-600112-S (FT-0.13.6.0)

Player.log is also attached, but the brief at the end is: issue-66-player.log

[00:59:46.744] [1] [ERROR] Calculated an invalid temperature: t1=366.5, m1=0, t2=366.5, m2=0, min_temp=366.5, max_temp=366.5
[00:59:46.757] [1] [INFO] Fast Track's patched_method Game.Update matched in the stack trace, adding to referenced mods list
[00:59:46.757] [1] [INFO] Piped Everything's patched_method ElementConverter.ConvertMass matched in the stack trace, adding to referenced mods list
Calculated an invalid temperature: t1=366.5, m1=0, t2=366.5, m2=0, min_temp=366.5, max_temp=366.5
[00:59:46.773] [1] [ERROR] <link="CARBONDIOXIDE">Carbon Dioxide</link> Invalid temperature [NaN]
Invalid temperature [NaN]
[00:59:47.093] [1] [INFO] Checking which steam branch we're on. Got: []

Seeing as this is referencing Carbon Dioxide, I have a number of pieces of equipment which may be causing this. Save file is attached at cycle 937. Tunnel Cycle 937.sav.zip

Truinto commented 1 month ago

It's a mystery to me why the converter outputs a zero mass object. My logic does not mess with this. I just flip the shouldStore flag, based on whenever the pipe is connected or not. Why this would only happen in a rare instance is also questionable.

Anyway, I have a super easy fix for GameUtil.GetFinalTemperature to not crash. I am pretty sure there is a big update coming this weekend. I would like to wait for that.

tekicode commented 1 month ago

Thanks for the quick reply! This hasn't been detrimental to any of my saves yet. I was able to continue after Cycle 937.

I suppose this could still be some interaction with Fast Track and a gas mass/temperature optimization. If I can get another repeat I'll open an issue over there just to have some more eyes on it.