Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vessel glitching and game crashing with stack overflow #4070

Closed
AidenUsername opened this issue Aug 17, 2024 · 6 comments · Fixed by #4072
Closed

Vessel glitching and game crashing with stack overflow #4070

AidenUsername opened this issue Aug 17, 2024 · 6 comments · Fixed by #4072
Milestone

Comments

@AidenUsername
Copy link

Playing on 1.12.5 launched a vessel from launchpad and flying 100m/s or above using Wacapella mod parts (WAC Corporal) would suddenly go 100km/s+ and crashing the game.
The mods used during the crash were: CNAR, Taerobee, Wacapella, Module Manager. Mods are downloaded from CKAN.

crash.dmp
ERROR.20240818-003704.18540.log
error.log
INFO.20240818-003704.18540.log
KSP.log
Player.log
WARNING.20240818-003704.18540.log

@AidenUsername
Copy link
Author

I forgot to mention that I'm using the latest version of Principia and that I narrowed down what mod or mods were crashing my game.

@pleroy
Copy link
Member

pleroy commented Aug 17, 2024

Thanks for reporting, and for providing us with the information necessary to investigate the bug.

Note to self: the recursive call that is causing trouble is, most surprisingly, this one. Interesting variables include:

Name Value Type
φ {magnitude_=9.7851614769491724e+22 } const principia::quantities::_quantities::internal::Quantity<principia::quantities::_dimensions::internal::Dimensions<0,0,0,0,0,0,0,1>> &
n -1.3509565896317132e-17 const double
mc 1.0000000000000000 const double
abs_φ_reduced {magnitude_=9.7851614769491724e+22 } principia::quantities::_quantities::internal::Quantity<principia::quantities::_dimensions::internal::Dimensions<0,0,0,0,0,0,0,1>>

@AidenUsername If you are able to reproduce the problem, could you give us a journal by following the instructions here? This would be useful in understanding how your game ended up in this situation.

@pleroy
Copy link
Member

pleroy commented Aug 17, 2024

Possibly useful information extracted from the dump here:

  Name Value Type
apparent_angular_momentum {coordinates_={x={magnitude_=17399137705057.844 } y={magnitude_=-10731242402471.562 } z={magnitude_=...} ...} } principia::geometry::_grassmann::internal::Multivector<principia::quantities::_quantities::internal::Quantity<principia::quantities::_dimensions::internal::Dimensions<2,1,-1,0,0,0,0,1>>,principia::geometry::_frame::internal::Frameprincipia::ksp_plugin::_pile_up::internal::ApparentPileUpTag,1,1,0,2>
  ◢ coordinates_ {x={magnitude_=17399137705057.844 } y={magnitude_=-10731242402471.562 } z={magnitude_=23826417990425.168 } ...} principia::geometry::_r3_element::internal::R3Element<principia::quantities::_quantities::internal::Quantity<principia::quantities::_dimensions::internal::Dimensions<2,1,-1,0,0,0,0,1>>>
apparent_inertia_tensor {matrix_={rows_={ size=3 } } } principia::geometry::_symmetric_bilinear_form::internal::SymmetricBilinearForm<principia::quantities::_quantities::internal::Quantity<principia::quantities::_dimensions::internal::Dimensions<2,1,0,0,0,0,0,0>>,principia::geometry::_frame::internal::Frameprincipia::ksp_plugin::_pile_up::internal::ApparentPileUpTag,1,1,0,principia::geometry::_grassmann::internal::Bivector>
  ◢ matrix_ {rows_={ size=3 } } principia::geometry::_r3x3_matrix::internal::R3x3Matrix<principia::quantities::_quantities::internal::Quantity<principia::quantities::_dimensions::internal::Dimensions<2,1,0,0,0,0,0,0>>>
  ◢ rows_ { size=3 } std::array<principia::geometry::_r3_element::internal::R3Element<principia::quantities::_quantities::internal::Quantity<principia::quantities::_dimensions::internal::Dimensions<2,1,0,0,0,0,0,0>>>,3>
  ◢ [0] {x={magnitude_=15.736129967865473 } y={magnitude_=-26.448287240035540 } z={magnitude_=10.029333552258198 } ...} principia::geometry::_r3_element::internal::R3Element<principia::quantities::_quantities::internal::Quantity<principia::quantities::_dimensions::internal::Dimensions<2,1,0,0,0,0,0,0>>>
  ◢ [1] {x={magnitude_=-26.448287240035540 } y={magnitude_=65.934857290134147 } z={magnitude_=4.3088382007932715 } ...} principia::geometry::_r3_element::internal::R3Element<principia::quantities::_quantities::internal::Quantity<principia::quantities::_dimensions::internal::Dimensions<2,1,0,0,0,0,0,0>>>
  ◢ [2] {x={magnitude_=10.029333552258198 } y={magnitude_=4.3088382007932715 } z={magnitude_=75.663730431082541 } ...} principia::geometry::_r3_element::internal::R3Element<principia::quantities::_quantities::internal::Quantity<principia::quantities::_dimensions::internal::Dimensions<2,1,0,0,0,0,0,0>>>

@AidenUsername
Copy link
Author

@pleroy pleroy changed the title Vessel glitching and game crashing Vessel glitching and game crashing with stack overflow Aug 18, 2024
@pleroy
Copy link
Member

pleroy commented Aug 18, 2024

So the proximate cause is that the evaluation of the elliptic integral requires an angle reduction, and that angle reduction fails because φ expressed in units of π doesn't fit on std::int64_t. I'll prepare a fix for that.

The original cause is more interesting, though: how do we end up with such a large value of φ, which surely is not physically realistic? The journal contains some interesting information:

E0818 14:09:05.079279 12172 player.cpp:101] index: 122058
[principia.journal.serialization.PartApplyIntrinsicTorque.extension] { in { plugin: 2031937590864 part_id: 1179018494 
torque_in_kilonewton_metre { x: -1686.04541015625 y: -5.1912569999694824 z: 1163.5037841796875 } } }

E0818 12:54:53.010848  8812 player.cpp:99] index: 122075
[principia.journal.serialization.PartSetApparentRigidMotion.extension] { in { plugin: 2031937590864 part_id: 
4119281075 degrees_of_freedom { q { x: -110.90555572509766 y: -0.22237659990787506 z: 76.5017318725586 } p { x: 
-240.11116027832031 y: -0.10341668128967285 z: 165.37773132324219 } } rotation { w: -0.11980406194925308 x: 
-0.6412169337272644 y: 0.69780033826828 z: 0.29590991139411926 } angular_velocity { x: 41.387321472167969 y: 
-0.028284728527069092 z: -28.808443069458008 } } }

E0818 14:09:05.096233 12172 player.cpp:101] index: 122252
[principia.journal.serialization.PartApplyIntrinsicTorque.extension] { in { plugin: 2031937590864 part_id: 1179018494 
torque_in_kilonewton_metre { x: 80506.3515625 y: 259.17025756835938 z: -55614.19921875 } } }

E0818 12:54:53.014835  8812 player.cpp:99] index: 122269
[principia.journal.serialization.PartSetApparentRigidMotion.extension] { in { plugin: 2031937590864 part_id: 
4119281075 degrees_of_freedom { q { x: -115.66475677490234 y: -0.26137903332710266 z: 79.654708862304688 } p { x: 
-237.86750793457031 y: -1.8396577835083008 z: 157.19346618652344 } } rotation { w: 0.24338869750499725 x: 
0.71233236789703369 y: -0.64068096876144409 z: -0.15123669803142548 } angular_velocity { x: -70.6441650390625 y: 
-3.9124388694763184 z: 49.749309539794922 } } }

E0818 14:09:05.112082 12172 player.cpp:101] index: 122436
[principia.journal.serialization.PartApplyIntrinsicTorque.extension] { in { plugin: 2031937590864 part_id: 1179018494 
torque_in_kilonewton_metre { x: -13794587648 y: -26517124 z: 9754898432 } } }

Note how part 1179018494 (Capella.FinLarge, but it's probably not the only culprit) is applying a large torque which changes sign at each frame. Conversely, the angular velocity of a representative part of the vessel (id 4119281075 , CapellaExperiment3, but they all behave in the same way) increases in magnitude at each frame and changes sign at each frame.

The torque in the first call above is about 2×10⁶ N.m, or 200 tons at 1 metre. It's hard to believe that the poor fin would resist such a torque (and it only goes up after that). Presumably that torque represents the way that the fin opposes the rotation of the rocket, but it should not cause the rotation to invert: the real world doesn't work that way.

I have a hunch that the part (and possibly others) is misconfigured. The scaling that happens here is suspicious. It's also notable that the angular drag is not scaled. This being said, I am not debugging other people's mods.

You might want to try using Ferram Aerospace Research as it doesn't depend on somewhat arbitrary coefficients in a configuration file, but, as far as I can tell, properly computes the effect of aerodynamics on parts based on their geometry.

@AidenUsername
Copy link
Author

Thanks for the reply and I am glad that I could help.
I have some conflicting mods in my modpack that would not work with FAR. Nothing else seems to be bugging out for me besides that mod. For now I will just avoid using parts from those mods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants