KSP-RO / TacLifeSupport

Life Support from Thunder Aerospace Corporation
Other
43 stars 24 forks source link

Misconfigured modules can cause endless log spam in BackgroundResources #135

Closed peter-sibiro closed 3 years ago

peter-sibiro commented 4 years ago

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.

JPLRepo commented 4 years ago

ok thanks for the info. will incorporate a fix in next version.

JPLRepo commented 3 years ago

fixed in V0.16.0