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

Appending before fork time #2490

Closed
barcharcraz opened this issue Mar 12, 2020 · 9 comments · Fixed by #2516
Closed

Appending before fork time #2490

barcharcraz opened this issue Mar 12, 2020 · 9 comments · Fixed by #2516

Comments

@barcharcraz
Copy link

Log file created at: 2020/03/12 09:09:17
Running on machine: DESKTOP-68GQI37
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
@ 00007FFE864D6360 google::LogMessageFatal::~LogMessageFatal [0x00007FFE864D635F+47]
@ 00007FFDF96788CC (No symbol) [0x00007FFDF96788CB]
@ 00007FFDF984E857 principia__VesselVelocity [0x00007FFDF984E856+1276966]
@ 00007FFDF984DF85 principia__VesselVelocity [0x00007FFDF984DF84+1274708]
@ 00007FFDF97F00B5 principia__VesselVelocity [0x00007FFDF97F00B4+889988]
@ 00007FFDF96E7998 principia__CatchUpLaggingVessels [0x00007FFDF96E7997+231]
@ 00000203C9FFAA17 (No symbol) [0x00000203C9FFAA16]
F0312 09:09:17.425650 28596 discrete_trajectory_body.hpp:170] Check failed: this->is_root() || time > this->Fork()->time Append at +6.25980497443201148e+03 s which is before fork time +6.26290882815326040e+03 s

I get these errors when seperating stages. I'm running quite a few mods which I understand could be an issue. Running Frenet on 1.8.1

@pleroy
Copy link
Member

pleroy commented Mar 12, 2020

Could you please give us your save and your logs? See the FAQs for instructions.

Sorry, something went wrong.

@barcharcraz
Copy link
Author

181real6.zip

Sorry, something went wrong.

@pleroy pleroy added the bug label Mar 12, 2020
@barcharcraz
Copy link
Author

Would it be helpful to try using the latest version from master?

@pleroy
Copy link
Member

pleroy commented Mar 12, 2020

For our information, the decoded stack:

Iterator** const collided_vessels) {
journal::Method<journal::CatchUpLaggingVessels> m({plugin},
{collided_vessels});
CHECK_NOTNULL(plugin);
VesselSet collided_vessel_set;
plugin->CatchUpLaggingVessels(collided_vessel_set);
void Plugin::CatchUpLaggingVessels(VesselSet& collided_vessels) {
CHECK(!initializing_);
// Start all the integrations in parallel.
std::vector<PileUpFuture> pile_up_futures;
for (auto* const pile_up : pile_ups_) {
pile_up_futures.emplace_back(
pile_up,
vessel_thread_pool_.Add([this, pile_up]() {
// Note that there cannot be contention in the following method as
// no two pile-ups are advanced at the same time.
return pile_up->DeformAndAdvanceTime(current_time_);
}));
}
// Wait for the integrations to finish and figure out which vessels collided
// with a celestial.
for (auto& pile_up_future : pile_up_futures) {
WaitForVesselToCatchUp(pile_up_future, collided_vessels);
}
// Update the vessels.
for (auto const& [_, vessel] : vessels_) {
if (vessel->psychohistory().back().time < current_time_) {
if (Contains(collided_vessels, vessel.get())) {
vessel->DisableDownsampling();
}
vessel->AdvanceTime();
void Vessel::AdvanceTime() {
// Squirrel away the prediction so that we can reattach it if we don't have a
// prognostication.
auto prediction = prediction_->DetachFork();
history_->DeleteFork(psychohistory_);
AppendToVesselTrajectory(&Part::history_begin,
&Part::history_end,
*history_);
psychohistory_ = history_->NewForkAtLast();
AppendToVesselTrajectory(&Part::psychohistory_begin,
DiscreteTrajectory<Barycentric>& trajectory) {
CHECK(!parts_.empty());
std::vector<DiscreteTrajectory<Barycentric>::Iterator> its;
std::vector<DiscreteTrajectory<Barycentric>::Iterator> ends;
its.reserve(parts_.size());
ends.reserve(parts_.size());
for (auto const& [_, part] : parts_) {
its.push_back((*part.*part_trajectory_begin)());
ends.push_back((*part.*part_trajectory_end)());
}
// Loop over the times of the trajectory.
for (;;) {
auto const& it0 = its[0];
bool const at_end_of_part_trajectory = it0 == ends[0];
Instant const first_time = at_end_of_part_trajectory ? Instant()
: it0->time;
// Loop over the parts at a given time.
BarycentreCalculator<DegreesOfFreedom<Barycentric>, Mass> calculator;
int i = 0;
for (auto const& [_, part] : parts_) {
auto& it = its[i];
CHECK_EQ(at_end_of_part_trajectory, it == ends[i]);
if (!at_end_of_part_trajectory) {
calculator.Add(it->degrees_of_freedom, part->mass());
CHECK_EQ(first_time, it->time);
++it;
}
++i;
}
if (at_end_of_part_trajectory) {
return;
}
// Append the parts' barycentre to the trajectory.
DegreesOfFreedom<Barycentric> const vessel_degrees_of_freedom =
calculator.Get();
trajectory.Append(first_time, vessel_degrees_of_freedom);
DegreesOfFreedom<Frame> const& degrees_of_freedom) {
CHECK(this->is_root() || time > this->Fork()->time)

@pleroy
Copy link
Member

pleroy commented Mar 12, 2020

Would it be helpful to try using the latest version from master?

I don't think so. There has been no change in this code since Frenet that would cause the bug to magically go away.

@pleroy pleroy changed the title Check failed: this->is_root() || time > this->Fork()->time Append at +6.25980497443201148e+03 s which is before fork time +6.26290882815326040e+03 s Appending before fork time Mar 12, 2020
@barcharcraz
Copy link
Author

Interestingly this happened twice for me, so I suspect that some mod I'm running is making this bug much more likely.

@pleroy
Copy link
Member

pleroy commented Mar 18, 2020

I have a hunch that some mod is creating parts out of step with the normal lifecycle of the game, and that this breaks one of our invariants. There are many messages like the following in your logs:

E0312 09:33:59.783618  5448 ksp_plugin_adapter.cs:966] Unpacked part mk1pod.v2 (7ACCEF60) appeared between BetterLateThanNever and WaitForFixedUpdate.  Linearly extrapolating its position at the previous frame.

At this point it would be useful to have a journal of the actions made by Principia. To do that, open Logging Settings in the main Principia window and select Record journal (starts on load) at the bottom left. Do a scene change to make sure that journaling is enabled (you should see Journaling is ON at the bottom right). Then try to reproduce the problem. If/when it fails again, send us the log files and the journal file found in your glog directory.

Journaling will make the game quite slow. Be sure to disable it once you've sent us the journal.

@pleroy
Copy link
Member

pleroy commented Mar 31, 2020

Duplicate of #2507. Follow the music there.

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