Misconfigured modules can cause endless log spam in BackgroundResources
vadim-zabrodin opened this issue ยท 2 comments
I recently stumbled across an issue, which should not happen under normal circumstances. However, this can lead to an endless log spam in BackgroundResources. The fix should be relatively trivial, so I believe it's reasonable to add some defensive checks in this place.
SolarPanel constructor takes two transforms via FindModelTransform and operates with them without checking the return
solarNormal = panelModule.part.FindModelTransform(panelModule.secondaryTransformName).forward;
pivotAxis = panelModule.part.FindModelTransform(panelModule.pivotName).up;
If the module is not properly configured (missing transforms), this leads to a Null pointer exception, which is not really a big deal by itself.
The problem is that the process ends prematurely and data is not added into InterestedVessel cache, and, as I got, the update process is repeated the very next tick (or so). This leads to a inflation of the log file. I've got almost 500Mb log within a few minutes.
Of course, the actual proper way is to fix the part in question and I'll send a note to the part author too. However, it seems adequate to add some checks in SolarPanel logic, maybe some fallback values (like vector3d.up) or turning off the faulty module processing via flag.