mockingbirdnest / Principia

𝑛-Body and Extended Body Gravitation for Kerbal Space Program
MIT License
770 stars 70 forks source link

Crash turning off Hack Gravity #3388

Open lpgagnon opened 2 years ago

lpgagnon commented 2 years ago
    @   00007FFAC11D443F    google::LogMessageFatal::~LogMessageFatal [0x00007FFAC11D443E+46]
    @   00007FFA857A50C1    principia__VesselVelocity [0x00007FFA857A50C0+1050160]
    @   00007FFA85675877    principia__InsertUnloadedPart [0x00007FFA85675876+646]
    @   000001AC8E03F277    (No symbol) [0x000001AC8E03F276]
F0701 18:24:55.874464  5856 plugin.cpp:1653] Check failed: inserted part_id: 64777563

First seen in Heine, consistently reproducible in Hesse. logs-3388.zip: logs & journal

Steps: (have not tried to reduce to minimal repro case)

lpgagnon commented 1 year ago

I've just accidentally confirmed this is still a thing in ‎𓇹𓄟𓋴𓏲

pleroy commented 1 year ago

This is still a thing because to be honest I never looked into it. A problem with "hack gravity" falls into the category "Doctor, it hurts when I do this!".

But you piqued my curiosity, so I tried, and indeed the reproduction steps above work. Now I am baffled.

I have a vessel with 3 parts: a pod, a decoupler, and a service bay (that's about as complex a vessel as I am capable of building). After decoupling I have the pod on one side and the decoupler + service bay on the other side. When "hack gravity" is turned off, the following happens:

  1. A vessel is inserted which, from its name, looks to be the "main" vessel. The following parts are inserted in that vessel: 1.1 The pod. 1.2 The decoupler. 1.3 The service bay.
  2. A second vessel is inserted, which is named "debris". The following parts are inserted in that vessel: 2.1 The decoupler. (This is where it 💥.) 2.2 The service bay.

The steps in bold (1.2 and 1.3) look wrong. It should not be possible for a part to belong to two vessels. I suspect that we have a case of KSP being incapable of maintaining its own invariants.

I have no idea how we can/should handle that madness. @eggrobin will need to look into this.