mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Contain failed placements and let engine failures end the chunk
Placement code caught Throwable and logged it, so a closed session, a stopping executor or an OOM inside a placement left a half-built chunk that was then persisted. A classifier in the api separates those failures from content failures: the first are rethrown, the second are skipped with one rate-limited warning per kind, subject and failure type. Upstream:54f3595baebe4aa1e47b38f7584f4f7e92a48cf9e01d9
This commit is contained in:
1 parent
fc5c6ce0ab
commit
de1c6e887f
13 files changed
+318
-22
No files matched your search
@@ -20,6 +20,7 @@ package art.arcane.iris.engine.decorator;
|
||||
import art.arcane.iris.builtin.decorant.DecorationPart;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import com.volmit.ModuleLog;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.geometry.BlockFace;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.block.BlockTrait;
|
||||
@@ -90,7 +91,7 @@ final class DecoratorCore {
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
log.error("A decorator failed to pick for the column", e);
|
||||
GenerationFailures.skipPlacement(log, e, "decorator", "chance gate", "at " + realX + "," + realZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +149,7 @@ final class DecoratorCore {
|
||||
data.set(x, lowerY, z, lower);
|
||||
data.set(x, upperY, z, upper);
|
||||
} catch (Throwable e) {
|
||||
scene.log().error("Failed to place a two-block plant", e);
|
||||
GenerationFailures.skipPlacement(scene.log(), e, "decoration", bd.toString(), "at " + realX + "," + lowerY + "," + realZ);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -318,7 +319,7 @@ final class DecoratorCore {
|
||||
data.set(xf, lowerY, zf, lower);
|
||||
data.set(xf, upperY, zf, upper);
|
||||
} catch (Throwable e) {
|
||||
scene.log().error("Failed to place a two-block plant", e);
|
||||
GenerationFailures.skipPlacement(scene.log(), e, "decoration", bd.toString(), "at " + xf + "," + lowerY + "," + zf);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
+10
-12
@@ -41,6 +41,7 @@ import com.volmit.ModuleLog;
|
||||
import com.volmit.config.FeatureSettings.Entry;
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.config.SettingsStack;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.object.PlaceableObject;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import com.volmit.stage.MantleStageContext;
|
||||
@@ -245,8 +246,8 @@ final class ChunkObjectPlacing {
|
||||
tally.triggered(scope);
|
||||
placeObject(tally, placement, scope);
|
||||
} catch (Throwable failure) {
|
||||
skipObjectPlacement("object", "in " + ownerKind(scope) + " " + ownerName, placement, failure);
|
||||
tally.errors++;
|
||||
logPlacementFailure("Failed to place objects in the following " + ownerKind(scope) + ": " + ownerName, placement, failure);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,8 +284,8 @@ final class ChunkObjectPlacing {
|
||||
try {
|
||||
placeCaveObject(tally, placement, profile, scope, expectedCaveBiome, anchors);
|
||||
} catch (Throwable failure) {
|
||||
skipObjectPlacement("cave object", "in " + ownerKind(scope) + " " + ownerName, placement, failure);
|
||||
tally.errors++;
|
||||
logPlacementFailure("Failed to place cave objects in the following " + ownerKind(scope) + ": " + ownerName, placement, failure);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -293,10 +294,8 @@ final class ChunkObjectPlacing {
|
||||
return scope.startsWith("biome") ? "biome" : "region";
|
||||
}
|
||||
|
||||
private void logPlacementFailure(String message, ObjectPlacement placement, Throwable failure) {
|
||||
log.error(message, failure);
|
||||
log.error("Object(s) " + String.join(", ", placement.place()) + " (" + failure.getClass().getSimpleName() + ").", null);
|
||||
log.error("Are these objects missing?", null);
|
||||
private void skipObjectPlacement(String kind, String where, ObjectPlacement placement, Throwable failure) {
|
||||
GenerationFailures.skipPlacement(log, failure, kind, String.join(", ", placement.place()), where);
|
||||
}
|
||||
|
||||
private void placeObject(Tally tally, ObjectPlacement placement, String scope) {
|
||||
@@ -337,9 +336,9 @@ final class ChunkObjectPlacing {
|
||||
}
|
||||
traceObjectResult(scope, object, result, x, z, densityIndex, density);
|
||||
} catch (Throwable failure) {
|
||||
GenerationFailures.skipPlacement(log, failure, "object", object.name(),
|
||||
"in chunk " + chunkX + "," + chunkZ + " scope " + scope + " attempt " + densityIndex + "/" + density);
|
||||
tally.errors++;
|
||||
log.error("Regen object placement exception: chunk=" + chunkX + "," + chunkZ + " scope=" + scope + " object=" + object.name()
|
||||
+ " densityIndex=" + densityIndex + " density=" + density + " error=" + failure.getClass().getSimpleName() + ":" + failure.getMessage(), failure);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,9 +372,9 @@ final class ChunkObjectPlacing {
|
||||
search.minDepthBelowSurface(), tags, null);
|
||||
tallyCave(tally, contained, scope, object, placement, i, density, search, anchor);
|
||||
} catch (Throwable failure) {
|
||||
GenerationFailures.skipPlacement(log, failure, "cave object", object.name(),
|
||||
"in chunk " + chunkX + "," + chunkZ + " scope " + scope + " attempt " + i + "/" + density);
|
||||
tally.errors++;
|
||||
log.error("Regen cave object placement exception: chunk=" + chunkX + "," + chunkZ + " scope=" + scope + " object=" + object.name()
|
||||
+ " densityIndex=" + i + " density=" + density + " error=" + failure.getClass().getSimpleName() + ":" + failure.getMessage(), failure);
|
||||
CaveRejects.log(log,scope, "EXCEPTION", chunkX, chunkZ, placement, object, i, density, search, anchor.y(), failure);
|
||||
}
|
||||
}
|
||||
@@ -430,8 +429,7 @@ final class ChunkObjectPlacing {
|
||||
try {
|
||||
placeUpperObject(placement, forcePlace, scope);
|
||||
} catch (Throwable failure) {
|
||||
log.error("Failed to place upper-dimension objects in " + kind + " " + ownerKey + ": " + String.join(", ", placement.place())
|
||||
+ " (" + failure.getClass().getSimpleName() + ")", failure);
|
||||
skipObjectPlacement("upper-dimension object", "in " + kind + " " + ownerKey, placement, failure);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -40,6 +40,7 @@ import com.volmit.ModuleLog;
|
||||
import com.volmit.config.FeatureSettings.Entry;
|
||||
import com.volmit.config.Level;
|
||||
import com.volmit.config.PackSettings;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.geometry.BlockBox;
|
||||
import com.volmit.geometry.BlockPosition;
|
||||
import com.volmit.resource.ResourceId;
|
||||
@@ -402,6 +403,7 @@ public final class FloatingObjectPlacing {
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
GenerationFailures.rethrowEngineFailure(e);
|
||||
log.error("Failed to work out the reach of the floating biomes' objects", e);
|
||||
}
|
||||
return maxObjectExtent;
|
||||
@@ -462,6 +464,7 @@ public final class FloatingObjectPlacing {
|
||||
reach = Math.max(reach, placementRadius(ResolvedFloatingChild.topObjects(child, surface)));
|
||||
reach = Math.max(reach, placementRadius(ResolvedFloatingChild.bottomObjects(child)));
|
||||
} catch (Throwable e) {
|
||||
GenerationFailures.rethrowEngineFailure(e);
|
||||
log.error("Failed to work out the reach of a floating biome's objects", e);
|
||||
}
|
||||
return reach;
|
||||
@@ -492,6 +495,7 @@ public final class FloatingObjectPlacing {
|
||||
}
|
||||
return reach;
|
||||
} catch (Throwable e) {
|
||||
GenerationFailures.rethrowEngineFailure(e);
|
||||
log.error("Failed to size a floating object", e);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.volmit.ModuleLog;
|
||||
import com.volmit.block.BlockRegistry;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.block.BlockTrait;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.geometry.BlockPosition;
|
||||
import com.volmit.object.BlockEntityData;
|
||||
import com.volmit.object.ObjectBlock;
|
||||
@@ -112,7 +113,7 @@ final class FloatingPlacer {
|
||||
try {
|
||||
place(ObjectRun.of(object, floating, worldX, SAMPLED_HEIGHT, worldZ), context.placementTerrain(), object, id);
|
||||
} catch (Throwable failure) {
|
||||
log.error("Failed to place a floating object", failure);
|
||||
GenerationFailures.skipPlacement(log, failure, "floating object", object.name(), "at " + worldX + "," + worldZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@ final class FloatingPlacer {
|
||||
}
|
||||
} catch (Throwable failure) {
|
||||
transaction.discard();
|
||||
log.error("Failed to place an " + kind + " floating object", failure);
|
||||
GenerationFailures.skipPlacement(log, failure, kind + " floating object", object.name(), "at " + worldX + "," + y + "," + worldZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import art.arcane.iris.modules.objects.ObjectSize;
|
||||
import com.volmit.ModuleLog;
|
||||
import com.volmit.config.FeatureSettings.Entry;
|
||||
import com.volmit.config.PackSettings;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.geometry.BlockBox;
|
||||
import com.volmit.resource.PackResources;
|
||||
|
||||
@@ -93,6 +94,7 @@ final class PlacementReach {
|
||||
}
|
||||
return reach;
|
||||
} catch (Throwable failure) {
|
||||
GenerationFailures.rethrowEngineFailure(failure);
|
||||
log.error("Failed to work out the reach of an object placement", failure);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.volmit.ModuleLog;
|
||||
import com.volmit.block.BlockRegistry;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.config.FeatureSettings;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.hunk.Hunk;
|
||||
import com.volmit.mantle.Mantle;
|
||||
import com.volmit.resource.ResourceId;
|
||||
@@ -229,7 +230,7 @@ final class FloatingIslands {
|
||||
RNG colRng = rng.nextParallelRNG((int) FloatingIslandSample.columnSeed(world.baseSeed(), wx, wz));
|
||||
FloatingDecorator.decorateColumn(scene, decorated, DecorationPart.NONE, xf, zf, wx, wz, topY, max, colRng, NOOP_DECORATION_MISS);
|
||||
} catch (Throwable e) {
|
||||
log.error("Failed to decorate the top of a floating island", e);
|
||||
GenerationFailures.skipPlacement(log, e, "decoration", "floating island top", "at " + wx + "," + topY + "," + wz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +264,7 @@ final class FloatingIslands {
|
||||
try {
|
||||
new IrisSeaSurfaceDecorator(scene).decorate(xf, zf, wx, wx + 1, wx - 1, wz, wz + 1, wz - 1, decorated, fluidTopY, chunk.height);
|
||||
} catch (Throwable e) {
|
||||
log.error("Failed to decorate the sea surface of a floating island", e);
|
||||
GenerationFailures.skipPlacement(log, e, "decoration", "floating island sea surface", "at " + wx + "," + fluidTopY + "," + wz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,7 +331,7 @@ final class FloatingIslands {
|
||||
try {
|
||||
generated.add(layer.get(random.nextParallelRNG(i + j), (wx + j) / layer.zoom(), j, (wz - j) / layer.zoom()));
|
||||
} catch (Throwable e) {
|
||||
log.error("Failed to pick a block of a floating island's palette", e);
|
||||
GenerationFailures.skipPlacement(log, e, "palette block", "floating island", "at " + wx + "," + wz + " depth " + j);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,6 +428,7 @@ final class FloatingIslands {
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
GenerationFailures.rethrowEngineFailure(e);
|
||||
log.error("Failed to write the sky biomes of a floating island", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import art.arcane.volmlib.util.math.RNG;
|
||||
import com.volmit.ModuleLog;
|
||||
import com.volmit.block.BlockState;
|
||||
import com.volmit.config.FeatureSettings;
|
||||
import com.volmit.generation.GenerationFailures;
|
||||
import com.volmit.noise.NoiseFactory;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import com.volmit.world.PackWorld;
|
||||
@@ -301,7 +302,7 @@ public final class BiomeLayers {
|
||||
try {
|
||||
blocks.add(layer.get(random, index + j, (wx + j) / blocksPerSample, j, (wz - j) / blocksPerSample));
|
||||
} catch (Throwable e) {
|
||||
log.error("A biome layer failed to pick a block", e);
|
||||
GenerationFailures.skipPlacement(log, e, "layer block", "biome layer " + index, "at " + (long) wx + "," + (long) wz + " depth " + j);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user