Crash to desktop and corrupted save after Phobos flyby

This issue has been tracked since 2022-06-10.

I have a repeatable crash scenario, performed with journaling active and all the relevant files and repro steps included in the linked zip.

Step 1: Load the game using quicksave "quicksave.sfs" I had made a copy of this and renamed it persistent.sfs for simplicity.
This quicksave should put you in command of a probe in Mars orbit with a maneuver planned to arrange a Phobos flyby
Step 2: Run the maneuver, and probably perform a small correction afterwards, to get a ~14km approach to Phobos
You might need to cheat electricity or just de-queue sending of data, this probe is a bit marginal on electricity and if the panels rotate away from the sun during warp, it goes dead
Step 3: At various points, I made quicksaves, tried scene transitions, etc. Everything was working until after the Phobos flyby.
Step 4: After the Phobos flyby, I created quicksave "Phobos pass". Note how much larger this quicksave is than the previous files.
Anecdotally as I've been trying to get a good repro of this, if the quicksave generated is around 63mb or lower, I can expect to be able to scene change successfully, in the instances where the quicksave is over 72mb, the game is going to crash on scene change and I will not be able to re-load that save.
Step 5: Attempt a scene change after the flyby. The game will crash to desktop with no alerts, dialogs, etc.

dgeastman wrote this answer on 2022-06-10

This set of repro steps is the shortest I've managed, but this is I believe the fourth time I've managed to get the game to crash after this Mars encounter. I've loaded various quicksaves from before this encounter and they all play as normal, but once I take this probe through various maneuvers at Mars, the game dies. I'm not sure if it's Phobos in particular, or just a specific amount of time in system doing manuevers, but my usual sequence has been to capture, do some orbit adjustments to get into plane, do a Deimos flyby, then do a Phobos flyby, then adjust my final Mars orbit, and scene change back to KSC and crash. The second time that sequence crashed, I started breaking it down into parts with quicksaves after each major maneuver or flyby.

pleroy wrote this answer on 2022-06-11

I was able to replay the journal and to reproduce the crash. No idea where it comes from yet, but I should be able to find the bug, ultimately. Thanks for taking the time to give us enough data that we can properly investigate this issue.

I am curious to understand what you did with the vessel named Mars Recon R8-B2U. Did you do lots of small burns? Did it collide a lot with some other thing? (a rendezvous; a kerbal in IVA; the ground; etc.) I am asking because that vessel defeats the compression that we try to apply to vessel trajectories, and I'd like to understand when that happens. No idea if it's related to the bug, but it surely explains why the save is getting significantly bigger.

dgeastman wrote this answer on 2022-06-11

That vessel is definitely the one that is having the issue, after I finish with that vessel in Mars is when I experience the crash. FYI last night, I basically gave up on that mission, and just left it orbiting Mars while I continued on with the game, and had no problems. I did a bunch of variations of the mission with that vessel trying to narrow down the repro case, but they all boil down to:

  1. Arrive at Mars and do a capture burn into a highly elliptic orbit, ~1100m/sec.
  2. Perform a burn to align with the plane of Deimos, ~200m/sec.
  3. Perform a burn to get a Deimos flyby. This one varied highly depending on how I did it, I think in the history that led to the save I gave you, it was a very small burn of ~4m/sec.
  4. Perform a burn to get a Phobos flyby. Again varied widely in my attempts, I think it was around 120m/sec in this history.
  5. Perform a correction burn on the way to Phobos, as that earlier burn usually went over or under.

Most of the burns ended up needing a manual correction as Mechjeb was just not hitting the target. I think the probe might not have CoT and CoM lined up properly. And then I would often do a small rcs correction to point back to the sun and spin up. So definitely "lots of small burns" in the craft history.

I did notice that watching the map view as it approaches Phobos, the prediction was not stable at all, even with the craft completely shut down and making no changes, the trajectory prediction would skitter back and forth a ton.

pleroy wrote this answer on 2022-06-11

Correction to my previous comment: I am not sure if I am able to reproduce the crash. More investigations needed.

eggrobin wrote this answer on 2022-06-11

(Lest we forget: this is probably the same thing as #3331. It is also probably likewise fiendishly difficult to reproduce; I don’t think we’ll get anywhere without weeks of shipping test builds to someone who can reproduce the issue.)

dgeastman wrote this answer on 2022-06-11

I can 100% reproduce this crash at will with that save file and repro steps I sent you. If necessary I can make a backup of my whole installation to make sure some later update or change doesn't hide the problem, or I could zip up all the non-squad mods in my install and send that.

NathanKell wrote this answer on 2022-06-11

For what it's worth I had a very similar problem the night of June 7th. I had sent a probe to Mars and was performing a capture burn, however on attempting to scene switch after the capture completed KSP froze. This happened 2 (3?) times in succession, and I gave up and called it a night (I had a quicksave just prior to capture). When I tried again the following night, loading the quicksave, all was well.

Attached are the logs from that playsession. I also present the state of my save repo after that play session (with the relevant quicksave, attempting to capture with Mariner 6).

and here is when I tried the first time to capture (rest of the stream is the capture, crash, try again, etc). (before that time is me setting up the maneuver).
The following night (ep 67) is the success, that's at the start of the video.

dgeastman wrote this answer on 2022-06-12

Another bit of info that may be of use: last night, I left that probe in it's condition of the save I sent, eg about 9 hours out on a trajectory for a Phobos flyby, and just ignored it, I went to the tracking center and ran a Venus lander instead, warping several weeks into the future in the process. Today I've resumed that save, and decided to take a backup and then hop over to Mars Recon R8-BTU and see if it would kill my save again. I was able to to perform the three burns to get into it's final Mars polar orbit, and the scene change back to the KSC and continue on. So whatever issue it was, it was transitory, and advancing past that time/flyby in another scene worked.

dgeastman wrote this answer on 2022-06-17

Here is my zipped gamedata folder, minus Squad

Repro steps were in a txt file in the first share, and covered above.

pleroy wrote this answer on 2022-06-19

It appears that the save is actually fine and that it's running into a (useless, obsolete) size check. The thing that confused me tremendously is that the maximum allowed size is 512 MiB (before compression) and no save that we have seen ever comes close to that number. However, quite interestingly, this one does (one vessel has a serialization of 250 MiB) but the compressors are surprisingly efficient so the final size of the save is much smaller (90 MiB).

The first order of business is to remove the check. However, this will only kick the can down the road as there is a hard limit of 2 GiB, and people will get there, ultimately.

I need to understand where the humongous save comes from, but I suspect that it's all checkpoints, and that we are running into the situation described by this note, i.e., lots of tiny trajectory segments separated by checkpoints. This will need to be fixed, but it's tricky code so it will take a little while.

NathanKell wrote this answer on 2022-06-19

Would that also explain very long save times? Since I too experienced this issue some amount, and my saves also take 5+s on a very fast rig, I'm wondering if they're related.

More Details About Repo
Owner Name mockingbirdnest
Repo Name Principia
Full Name mockingbirdnest/Principia
Language C++
Created Date 2014-02-08
Updated Date 2023-03-29
Star Count 664
Watcher Count 29
Fork Count 62
Issue Count 109


Issue Title Created Date Updated Date