mockingbirdnest / Principia

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

Check failed: std::gcd(Dᴛₒ, Cᴛₒ) == 1 #3831

Open lpgagnon opened 8 months ago

lpgagnon commented 8 months ago

Seen twice in a row, but wasn't able to reproduce with journaling on.

    @        0x69884d844  principia::astronomy::_orbit_recurrence::internal::OrbitRecurrence::OrbitRecurrence()
    @        0x698875de1  principia::ksp_plugin::_orbit_analyser::internal::OrbitAnalyser::AnalyseOrbit()
    @        0x698879958  _ZNSt3__1L14__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN9principia4base8_jthread8internalL19MakeStoppableThreadIZNS7_10ksp_plugin15_orbit_analyser8internal13OrbitAnalyser15RequestAnalysisERKNSF_10ParametersEE3$_0JEEENSA_7jthreadEOT_DpOT0_EUlRKNSA_10stop_tokenEE_SQ_EEEEEPvSV_
    @     0x7ff8142ff1d3  _pthread_start
F1231 20:12:02.344707 3476037632 orbit_recurrence_body.hpp:33] Check failed: std::gcd(Dᴛₒ, Cᴛₒ) == 1 (16 vs. 1) [-2147483648; -2147483648; -818929872]

Context: vessel trajectory is Uranus flyby, roughly in Triton's plane, with Pe near Triton altitude. Creating a flight plan for Triton capture: one maneuver plotted at Pe to achieve highly elliptical Uranus capture, and finetuning it to get a Triton encounter on the next pass.

Both times, crash occurred while fiddling to get Triton Pe just above its atmosphere.

checkfailed 3831.zip

eggrobin commented 7 months ago

Unfortunately we do not have a stacktrace decoder for mac, but I think this is it.

νₒ = Dᴛₒ = -2147483648 might be std::nearbyint on a NaN or infinity. Cᴛₒ = -818929872 is strange. Maybe uninitialized?

https://github.com/mockingbirdnest/Principia/blob/4eb331daade61aaa69108e187bb516707287fb98/ksp_plugin/orbit_analyser.cpp#L101-L155 https://github.com/mockingbirdnest/Principia/blob/4eb331daade61aaa69108e187bb516707287fb98/astronomy/orbit_recurrence_body.hpp#L51-L79 https://github.com/mockingbirdnest/Principia/blob/4eb331daade61aaa69108e187bb516707287fb98/astronomy/orbit_recurrence_body.hpp#L23-L33