Remove updateSuppressionCrashFix and related logger (#1445)
This commit is contained in:
1 parent
b0a2f2c9f2
commit
08a65902f5
7 files changed
-166
No files matched your search
@@ -1048,12 +1048,6 @@ public class CarpetSettings
|
|||||||
)
|
)
|
||||||
public static int updateSuppressionBlock = -1;
|
public static int updateSuppressionBlock = -1;
|
||||||
|
|
||||||
@Rule(
|
|
||||||
desc = "Fixes update suppression causing server crashes.",
|
|
||||||
category = BUGFIX
|
|
||||||
)
|
|
||||||
public static boolean updateSuppressionCrashFix = false;
|
|
||||||
|
|
||||||
private static class UpdateSuppressionBlockModes extends Validator<Integer> {
|
private static class UpdateSuppressionBlockModes extends Validator<Integer> {
|
||||||
@Override
|
@Override
|
||||||
public Integer validate(CommandSourceStack source, ParsedRule<Integer> currentRule, Integer newValue, String string) {
|
public Integer validate(CommandSourceStack source, ParsedRule<Integer> currentRule, Integer newValue, String string) {
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ public class LoggerRegistry
|
|||||||
public static boolean __packets;
|
public static boolean __packets;
|
||||||
public static boolean __pathfinding;
|
public static boolean __pathfinding;
|
||||||
public static boolean __explosions;
|
public static boolean __explosions;
|
||||||
public static boolean __updateSuppressedCrashes;
|
|
||||||
|
|
||||||
public static void initLoggers()
|
public static void initLoggers()
|
||||||
{
|
{
|
||||||
@@ -47,7 +46,6 @@ public class LoggerRegistry
|
|||||||
registerLogger("counter",HUDLogger.stardardHUDLogger("counter","white", Arrays.stream(DyeColor.values()).map(Object::toString).toArray(String[]::new)));
|
registerLogger("counter",HUDLogger.stardardHUDLogger("counter","white", Arrays.stream(DyeColor.values()).map(Object::toString).toArray(String[]::new)));
|
||||||
registerLogger("mobcaps", HUDLogger.stardardHUDLogger("mobcaps", "dynamic",new String[]{"dynamic", "overworld", "nether","end"}));
|
registerLogger("mobcaps", HUDLogger.stardardHUDLogger("mobcaps", "dynamic",new String[]{"dynamic", "overworld", "nether","end"}));
|
||||||
registerLogger("explosions", Logger.stardardLogger("explosions", "brief",new String[]{"brief", "full"}, true));
|
registerLogger("explosions", Logger.stardardLogger("explosions", "brief",new String[]{"brief", "full"}, true));
|
||||||
registerLogger("updateSuppressedCrashes", Logger.stardardLogger("updateSuppressedCrashes", null,null));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import carpet.CarpetSettings;
|
|
||||||
import carpet.helpers.ThrowableSuppression;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import net.minecraft.world.level.block.Block;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
|
||||||
|
|
||||||
@Mixin(Level.class)
|
|
||||||
public class Level_updateSuppressionCrashFixMixin {
|
|
||||||
|
|
||||||
@Inject(
|
|
||||||
method = "neighborChanged",
|
|
||||||
at = @At(
|
|
||||||
value="INVOKE",
|
|
||||||
target = "Lnet/minecraft/CrashReport;forThrowable(Ljava/lang/Throwable;Ljava/lang/String;)Lnet/minecraft/CrashReport;"
|
|
||||||
),
|
|
||||||
locals = LocalCapture.CAPTURE_FAILHARD,
|
|
||||||
require = 0
|
|
||||||
)
|
|
||||||
public void checkUpdateSuppression(BlockPos sourcePos, Block sourceBlock, BlockPos neighborPos, CallbackInfo ci, BlockState state,Throwable throwable){
|
|
||||||
if(CarpetSettings.updateSuppressionCrashFix && (throwable instanceof ThrowableSuppression || throwable instanceof StackOverflowError)){
|
|
||||||
throw new ThrowableSuppression("Update suppression", neighborPos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import carpet.CarpetSettings;
|
|
||||||
import carpet.helpers.ThrowableSuppression;
|
|
||||||
import carpet.logging.LoggerRegistry;
|
|
||||||
import carpet.utils.Messenger;
|
|
||||||
import net.minecraft.ReportedException;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
|
|
||||||
import java.util.function.BooleanSupplier;
|
|
||||||
|
|
||||||
@Mixin(MinecraftServer.class)
|
|
||||||
public class MinecraftServer_updateSuppressionCrashFixMixin {
|
|
||||||
|
|
||||||
@Redirect(
|
|
||||||
method = "tickChildren",
|
|
||||||
at = @At(
|
|
||||||
value = "INVOKE",
|
|
||||||
target = "Lnet/minecraft/server/level/ServerLevel;tick(Ljava/util/function/BooleanSupplier;)V"
|
|
||||||
),
|
|
||||||
require = 0
|
|
||||||
)
|
|
||||||
private void fixUpdateSuppressionCrashTick(ServerLevel serverWorld, BooleanSupplier shouldKeepTicking){
|
|
||||||
if (!CarpetSettings.updateSuppressionCrashFix) {
|
|
||||||
serverWorld.tick(shouldKeepTicking);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
serverWorld.tick(shouldKeepTicking);
|
|
||||||
} catch (ReportedException e) {
|
|
||||||
if (!(e.getCause() instanceof ThrowableSuppression throwableSuppression)) throw e;
|
|
||||||
logUpdateSuppression(throwableSuppression.pos);
|
|
||||||
} catch (ThrowableSuppression e) {
|
|
||||||
logUpdateSuppression(e.pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void logUpdateSuppression(BlockPos pos) {
|
|
||||||
if(LoggerRegistry.__updateSuppressedCrashes) {
|
|
||||||
LoggerRegistry.getLogger("updateSuppressedCrashes").log(() -> {
|
|
||||||
return new Component[]{Messenger.c(
|
|
||||||
"w Server crash prevented in: ",
|
|
||||||
"m world tick ",
|
|
||||||
"w - at: ",
|
|
||||||
"g [ " + pos.toShortString() + " ]"
|
|
||||||
)};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -38,10 +38,6 @@ public abstract class ServerPlayer_actionPackMixin implements ServerPlayerEntity
|
|||||||
{
|
{
|
||||||
actionPack.onUpdate();
|
actionPack.onUpdate();
|
||||||
}
|
}
|
||||||
catch (StackOverflowError soe)
|
|
||||||
{
|
|
||||||
CarpetSettings.LOG.error("Caused stack overflow when performing player action", soe);
|
|
||||||
}
|
|
||||||
catch (Throwable exc)
|
catch (Throwable exc)
|
||||||
{
|
{
|
||||||
CarpetSettings.LOG.error("Error executing player tasks", exc);
|
CarpetSettings.LOG.error("Error executing player tasks", exc);
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import carpet.CarpetSettings;
|
|
||||||
import carpet.helpers.ThrowableSuppression;
|
|
||||||
import carpet.logging.LoggerRegistry;
|
|
||||||
import carpet.utils.Messenger;
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import net.minecraft.ReportedException;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.network.chat.Component;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.entity.player.ProfilePublicKey;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
|
|
||||||
@Mixin(ServerPlayer.class)
|
|
||||||
public abstract class ServerPlayer_updateSuppressionCrashFixMixin extends Player {
|
|
||||||
|
|
||||||
public ServerPlayer_updateSuppressionCrashFixMixin(Level level, BlockPos blockPos, float f, GameProfile gameProfile, ProfilePublicKey profilePublicKey) {
|
|
||||||
super(level, blockPos, f, gameProfile, profilePublicKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Redirect(
|
|
||||||
method = "doTick()V",
|
|
||||||
at = @At(
|
|
||||||
value = "INVOKE",
|
|
||||||
target = "Lnet/minecraft/world/entity/player/Player;tick()V"
|
|
||||||
),
|
|
||||||
require = 0
|
|
||||||
)
|
|
||||||
private void fixUpdateSuppressionCrashPlayerTick(Player playerEntity){
|
|
||||||
if (!CarpetSettings.updateSuppressionCrashFix) {
|
|
||||||
super.tick();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
super.tick();
|
|
||||||
} catch (ReportedException e) {
|
|
||||||
if (!(e.getCause() instanceof ThrowableSuppression throwableSuppression)) throw e;
|
|
||||||
logUpdateSuppressionPlayer(throwableSuppression.pos);
|
|
||||||
} catch (ThrowableSuppression e) {
|
|
||||||
logUpdateSuppressionPlayer(e.pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void logUpdateSuppressionPlayer(BlockPos pos) {
|
|
||||||
if(LoggerRegistry.__updateSuppressedCrashes) {
|
|
||||||
LoggerRegistry.getLogger("updateSuppressedCrashes").log(() -> {
|
|
||||||
return new Component[]{Messenger.c(
|
|
||||||
"w Server crash prevented in: ",
|
|
||||||
"m player tick ",
|
|
||||||
"w - at: ",
|
|
||||||
"g [ " + pos.toShortString() + " ]"
|
|
||||||
)};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -181,9 +181,6 @@
|
|||||||
"ShulkerBoxBlockEntity_creativeNoClipMixin",
|
"ShulkerBoxBlockEntity_creativeNoClipMixin",
|
||||||
"TheEndGatewayBlockEntity_creativeNoClipMixin",
|
"TheEndGatewayBlockEntity_creativeNoClipMixin",
|
||||||
"LivingEntity_creativeFlyMixin",
|
"LivingEntity_creativeFlyMixin",
|
||||||
"Level_updateSuppressionCrashFixMixin",
|
|
||||||
"MinecraftServer_updateSuppressionCrashFixMixin",
|
|
||||||
"ServerPlayer_updateSuppressionCrashFixMixin",
|
|
||||||
"ChunkMap_creativePlayersLoadChunksMixin",
|
"ChunkMap_creativePlayersLoadChunksMixin",
|
||||||
"SculkSensorBlock_rangeMixin",
|
"SculkSensorBlock_rangeMixin",
|
||||||
"CollectingNeighborUpdaterAccessor"
|
"CollectingNeighborUpdaterAccessor"
|
||||||
|
|||||||
Reference in new issue
Block a user