NaNs in cofig file crash game when loading a vessel
Closed this issue · 3 comments
At some point I noticed that switiching to some of my vessels results in a weird game behavior: from empty screen with a lot of errors in the debug log to a plain crash. After a long investigation I've figured out that it only happens to a vessel that has a "NaN" value saved into PersistentRotation_<username>.cfg
.
Here is an example that results into a repeating error in the debug log:
MOMENTUM
{
d199c734-cc47-4075-9e67-0ad0dfe7d1a1 = NaN,NaN,NaN
}
ROTATION
{
d199c734-cc47-4075-9e67-0ad0dfe7d1a1 = NaN,NaN,NaN
}
DIRECTION
{
d199c734-cc47-4075-9e67-0ad0dfe7d1a1 = NaN,NaN,NaN
}
REFERENCE
{
d199c734-cc47-4075-9e67-0ad0dfe7d1a1 = Sun
}
This results in an empty screen and a lot of error in the log from MechJeb2 reported in each frame:
getObtAtUT result is NaN! UT: <some increasing number>
This is not the only error, actually. There are more modules complaining but copying them all here doesn't seem to be a good idea.
I workaround it by periodic cleanup of the mentioned config file by just dropping records with NaNs but it would be nice to have a protection in the code to not write out NaN values. I cannot give repro steps to make PR writing these values.
A side note to this config file: looks like it stores info for objects that have PR setting set to NONE
. Why? If not set, just skip it to avoid any issues.
Will look into that.
Anyway, does it happen without any other mods installed? If not, please post the mods you are using.
Never tested it with no mods. This issue needs some time to accumulate. It happens from time to time on my old save game (~200 hours of game) but on the fresh start I never witnessed it. In the oldest save game PR tracks ~100 different GUIDs in the REFERENCE
section.
From my personal observations I'd say this issue is somehow related to "revert flight" option and KAC plugin. When I frequently revert flights (e.g. while testing a new design) and switch between vessels via KAC the probability of getting the issue is gets much higher. Though, I cannot give exact reproduce steps.
I was never able to reproduce the bug. Also, the new save system should have fixed that.