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

crash on loading a save with animals #5051

Open
keturn opened this issue Jun 17, 2022 · 3 comments
Open

crash on loading a save with animals #5051

keturn opened this issue Jun 17, 2022 · 3 comments
Labels
Blocker Issue reporting or PR addressing a critical problem that blocks other efforts Category: Crash Requests, Issues and Changes targeting unexpected terminations, segfaults, etc. Status: Needs Investigation Requires to be debugged or checked for feasibility, etc. Status: Needs Testing Requires to be tested in-game for reproducibility Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Type: Bug Issues reporting and PRs fixing problems

Comments

@keturn
Copy link
Member

keturn commented Jun 17, 2022

In current development versions of Terasology, I get a fatal crash whenever trying to load a save game with sheep or deer.

Traceback is something like this:

[main] ERROR o.t.engine.core.modes.StateLoading - Error while loading org.terasology.engine.core.modes.loadProcesses.LoadEntities@21f8693e
java.lang.NullPointerException: null
	at org.terasology.engine.rendering.logic.SkeletonRenderer.newSkeleton(SkeletonRenderer.java:110)
	[…]
	at org.terasology.engine.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:190)
	at org.terasology.engine.entitySystem.entity.EntityBuilder.build(EntityBuilder.java:110)
	at org.terasology.engine.entitySystem.entity.internal.PojoEntityManager.createEntityWithId(PojoEntityManager.java:376)
	at org.terasology.engine.persistence.serializers.EntitySerializer.deserialize(EntitySerializer.java:168)
	at org.terasology.engine.persistence.internal.GlobalStoreLoader.load(GlobalStoreLoader.java:58)
	at org.terasology.engine.persistence.internal.AbstractStorageManager.loadGlobalStore(AbstractStorageManager.java:80)

The that's here:

for (Bone bone : skeleton.mesh.getBones()) {
EntityRef boneEntity = skeleton.boneEntities.get(bone.getName());
LocationComponent loc = boneEntity.getComponent(LocationComponent.class);

skeleton.boneEntities is non-empty, but all the references in it are EntityRef.NULL, so those have no LocationComponent.

I believe the null entity references come from here:

public Optional<EntityRef> deserialize(PersistedData data) {
if (data.isNumber()) {
return Optional.ofNullable(entityManager.getEntity(data.getAsLong()));
}
return Optional.ofNullable(EntityRef.NULL);

Is there some weird thing with loading the graph where those references are defined later in the global store, and they're not yet available when the deserializer tries to reference them?

it's also kinda weird that that's during GloabalStoreLoader, because I think those animals should be saved at chunk-level, not in the global store?

maybe their bones are in the chunk store but the rest of their SkeletalMeshComponent is in the global store?

@keturn keturn added Type: Bug Issues reporting and PRs fixing problems Status: Needs Investigation Requires to be debugged or checked for feasibility, etc. Blocker Issue reporting or PR addressing a critical problem that blocks other efforts Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Category: Crash Requests, Issues and Changes targeting unexpected terminations, segfaults, etc. labels Jun 17, 2022
@keturn
Copy link
Member Author

keturn commented Jun 22, 2022

Notes from #stabilization:

Niruandaleth failed to reproduce the problem.

A save game made on her system loads just fine here, which confirms the issue is in saving, not loading.

I tried reproducing on a second system, and found it was much rarer. Whereas I can reproduce it all the time on my normal development system, on that one it usually worked fine. It was only when I'd messed with some graphics settings and the deer were kinda glitching out while in the pause menu that it produced the broken save.

That was on Windows 10 with an i7-9700, compared to my usual Linux and i7-6700.

The working save file: savegame.tar.gz
The same game, after loading and getting re-saved here: keturn_broke_the-savegame.tar.gz

@keturn
Copy link
Member Author

keturn commented Jun 22, 2022

Some of the corrupt data comes from #5054

but perhaps not all of it.

My manual test involved going out and finding sheep, but that was taking too long, especially because spawn locations are not reproducible. So I've been trying other things.

It seems like starting a new game and doing spawnPrefab sheep is not sufficient to reproduce.

The bug may involve having sheep in chunks that you've already moved away from, or perhaps moving far enough away from 0, 0 that it's no longer currently loaded.

@keturn
Copy link
Member Author

keturn commented Jul 1, 2022

I believe this still exists but it I've found it a lot harder to reproduce since #5054 was merged.

I think I reproduced it once after walking > 13 chunks. Then I was trying to narrow it down to a faster scenario. Turning view distance down, messing with the WildAnimals spawn rate, turning LOD up or down, using the console to spawn a sheep... didn't come up with any obvious trigger actions for it. There were sometimes entity references that didn't get resolved on load, but they didn't turn in to crashers.

If this bug isn't popping up for other people, I'm willing to remove the Blocker label from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocker Issue reporting or PR addressing a critical problem that blocks other efforts Category: Crash Requests, Issues and Changes targeting unexpected terminations, segfaults, etc. Status: Needs Investigation Requires to be debugged or checked for feasibility, etc. Status: Needs Testing Requires to be tested in-game for reproducibility Topic: Stabilization Requests, Issues and Changes related to improving stablity and reducing flakyness Type: Bug Issues reporting and PRs fixing problems
Projects
Status: Todo
Status: 🔍 Needs Confirmation
Development

No branches or pull requests

1 participant