mockingbirdnest / Principia

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

KSP crashed while paused, now savefile won't load #2071

Closed kbios closed 5 years ago

kbios commented 5 years ago

Logs Hi, this is with KSP 1.5.1 under Linux x64 and Principia Εὔδοξος. I was doing a mission to Jool, paused the game for half an hour or so. When I returned the game had crashed. I started it up again, but it now crashes every time as soon as I load the savefile. In the linked gist there is the (long) log of the mission before it crashed and the logs from when it crashes while loading.

kbios commented 5 years ago

I tried restoring a previous backup of the savefile, that one loads but as soon as I click on tracking station it crashes with:

*** Check failure stack trace: ***
    @     0x7fe14aadd737  principia::numerics::internal_polynomial::Polynomial<>::ReadFromMessage<>()
    @     0x7fe14aaa9bd8  principia::physics::internal_continuous_trajectory::ContinuousTrajectory<>::ReadFromMessage()
    @     0x7fe14a9d556b  principia::physics::internal_ephemeris::Ephemeris<>::ReadFromMessage()
    @     0x7fe14a9cb143  principia::ksp_plugin::internal_plugin::Plugin::ReadFromMessage()
    @     0x7fe14a97fbe4  std::__1::__function::__func<>::operator()()
    @     0x7fe14a9934fc  _ZZN9principia4base26internal_push_deserializer16PushDeserializer5StartENS0_8not_nullIPN6google8protobuf7MessageEEENSt3__18functionIFvRKS6_EEEENKUlvE_clEv
    @     0x7fe14a99322b  _ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN9principia4base26internal_push_deserializer16PushDeserializer5StartENS8_8not_nullIPN6google8protobuf7MessageEEENS_8functionIFvRKSE_EEEEUlvE_EEEEEPvSO_
    @       0x36f3e076da  start_thread
    @       0x36f332188e  clone
F0130 21:16:59.936522 11622 point_body.hpp:35] Check failed: message.has_scalar() 

Native stacktrace:

    /home/alberto/KSP/KSP_linux151/KSP_Data/Mono/x86_64/libmono.so(+0x92406) [0x7fe49437b406]
    /lib/x86_64-linux-gnu/libpthread.so.0() [0x36f3e1288f]
    /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7) [0x36f323ee97]
    /lib/x86_64-linux-gnu/libc.so.6(abort+0x140) [0x36f3240800]
    GameData/Principia/Linux64/principia.so(+0xb9f579) [0x7fe14ac3b579]
    GameData/Principia/Linux64/principia.so(_ZN6google10LogMessage9SendToLogEv+0x3ea) [0x7fe14ac32ffa]
    GameData/Principia/Linux64/principia.so(_ZN6google10LogMessage5FlushEv+0xc0) [0x7fe14ac33560]
    GameData/Principia/Linux64/principia.so(_ZN6google15LogMessageFatalD2Ev+0x79) [0x7fe14ac36d69]
    GameData/Principia/Linux64/principia.so(_ZN9principia8geometry14internal_point15PointSerializerINS_10quantities19internal_quantities8QuantityINS3_19internal_dimensions10DimensionsILl0ELl0ELl1ELl0ELl0ELl0ELl0ELl0EEEEEE15ReadFromMessageERKNS_13serialization5PointE+0xbc) [0x7fe14a908fbc]
    GameData/Principia/Linux64/principia.so(_ZN9principia8numerics19internal_polynomial25PolynomialInMonomialBasisINS_8geometry18internal_grassmann11MultivectorINS_10quantities19internal_quantities8QuantityINS6_19internal_dimensions10DimensionsILl1ELl0ELl0ELl0ELl0ELl0ELl0ELl0EEEEENS3_14internal_frame5FrameINS_13serialization15Frame_PluginTagELSG_7ELb1EEELi1EEENS3_14internal_point5PointINS8_INSA_ILl0ELl0ELl1ELl0ELl0ELl0ELl0ELl0EEEEEEELi4ENS0_30internal_polynomial_evaluators15EstrinEvaluatorEE15ReadFromMessageERKNSF_10PolynomialE+0xea) [0x7fe14aadee3a]
    GameData/Principia/Linux64/principia.so(_ZN9principia8numerics19internal_polynomial10PolynomialINS_8geometry18internal_grassmann11MultivectorINS_10quantities19internal_quantities8QuantityINS6_19internal_dimensions10DimensionsILl1ELl0ELl0ELl0ELl0ELl0ELl0ELl0EEEEENS3_14internal_frame5FrameINS_13serialization15Frame_PluginTagELSG_7ELb1EEELi1EEENS3_14internal_point5PointINS8_INSA_ILl0ELl0ELl1ELl0ELl0ELl0ELl0ELl0EEEEEEEE15ReadFromMessageINS0_30internal_polynomial_evaluators15EstrinEvaluatorEEENS_4base8not_nullINSt3__110unique_ptrISO_NSU_14default_deleteISO_EEEEEERKNSF_10PolynomialE+0x287) [0x7fe14aadd737]
    GameData/Principia/Linux64/principia.so(_ZN9principia7physics30internal_continuous_trajectory20ContinuousTrajectoryINS_8geometry14internal_frame5FrameINS_13serialization15Frame_PluginTagELS7_7ELb1EEEE15ReadFromMessageERKNS6_20ContinuousTrajectoryE+0x628) [0x7fe14aaa9bd8]
    GameData/Principia/Linux64/principia.so(_ZN9principia7physics18internal_ephemeris9EphemerisINS_8geometry14internal_frame5FrameINS_13serialization15Frame_PluginTagELS7_7ELb1EEEE15ReadFromMessageERKNS6_9EphemerisE+0x70b) [0x7fe14a9d556b]
    GameData/Principia/Linux64/principia.so(_ZN9principia10ksp_plugin15internal_plugin6Plugin15ReadFromMessageERKNS_13serialization6PluginE+0x273) [0x7fe14a9cb143]
    GameData/Principia/Linux64/principia.so(+0x8e3be4) [0x7fe14a97fbe4]
    GameData/Principia/Linux64/principia.so(_ZZN9principia4base26internal_push_deserializer16PushDeserializer5StartENS0_8not_nullIPN6google8protobuf7MessageEEENSt3__18functionIFvRKS6_EEEENKUlvE_clEv+0x21c) [0x7fe14a9934fc]
    GameData/Principia/Linux64/principia.so(_ZNSt3__114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN9principia4base26internal_push_deserializer16PushDeserializer5StartENS8_8not_nullIPN6google8protobuf7MessageEEENS_8functionIFvRKSE_EEEEUlvE_EEEEEPvSO_+0x2b) [0x7fe14a99322b]
    /lib/x86_64-linux-gnu/libpthread.so.0() [0x36f3e076da]
    /lib/x86_64-linux-gnu/libc.so.6(clone+0x3e) [0x36f332188e]
I refuse to debug myself!
No threads.
kbios commented 5 years ago

After futher investigation it seems that the problem could be that the savefile itself got corrupted somehow during the crash, so it would not be a bug in principia per se...

pleroy commented 5 years ago

From the crash message it does look like the save is incomplete. Could you give us the save? We probably won't be able to fix it but we'd be interested to look.

kbios commented 5 years ago

Sure, thanks for taking a look! :) This is the save that crashes while loading Newhope.zip And this is the previous backup that loads but crashes when I click on the tracking station persistent (2019_01_30_20_06_15).sfs.zip You'll probably need the SpaceY parts to load them

pleroy commented 5 years ago

(Apologies for taking so long to look into this.)

The full error message is:

[libprotobuf ERROR c:\users\phl\projects\github\principia\google\protobuf\src\google\protobuf\message_lite.cc:318] Can't parse messa
ge of type "principia.serialization.Plugin" because it is missing required fields: ephemeris.trajectory[15].instant_polynomial_pair[
92].t_max.scalar.dimensions, ephemeris.trajectory[15].instant_polynomial_pair[92].t_max.scalar.magnitude

It happens on the last serialized_plugin block of the save, so we know that we were able to completely decompress the save (no bit flips, for instance). However there is apparently not enough data to fill required data in a celestial trajectory.

It's impossible to say for sure what happened, but here is a plausible scenario: when trying to save (maybe as part of an autosave?) Principia ran out of memory and failed to write all of its data to disk. The rest of KSP (and other mods?) were able to write their part, so the save itself is not truncated, only the Principia part.

Not much can be done at this point so I am going to close this bug as obsolete.