friendlyhj/ZenUtils

[Feature Request] Dump stack trace on `Exception occurred in a catenation`

Closed this issue · 3 comments

Right now i have something wrong with catenation executions. I have this lines in crafttweaker.log:

[SERVER_STARTED][SERVER][ERROR] Exception occurred in a catenation task, stopping the catenation...
java.lang.NullPointerException

I tried to /ct reload and problem is still there.

There is output in debug.log file:

[16:51:22] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: Exception occurred in a catenation task, stopping the catenation..., caused by java.lang.NullPointerException
[16:51:22] [Client thread/INFO] [net.minecraft.client.gui.GuiNewChat]: [CHAT] §cERROR: Exception occurred in a catenation task, stopping the catenation..., caused by java.lang.NullPointerException

Please add full stack trace, so i could find source of error.

Someone told me the exception stack trace won't be printed after script reloading. But I couldn't reproduce the bug.

// functions.zs
#loader crafttweaker reloadable
#priority 100
import crafttweaker.item.IItemStack;

function throwException() as void {
    val item as IItemStack = null;
    print(item.commandString);
}

// reload.zs
#loader crafttweaker reloadable
import crafttweaker.event.PlayerCraftedEvent;
import crafttweaker.player.IPlayer;

events.onPlayerCrafted(function(event as PlayerCraftedEvent) {
    val player as IPlayer = event.player;
    if (event.player.world.remote) return;
    event.player.world.catenation() // builds a new catenation
        .run(function(world, context) {
            scripts.functions.throwException();
        })
        .start();
});

log:

[SERVER_STARTED][SERVER][INFO] [reloadable | SIDE_CLIENT]: Loading Script: {[0:crafttweaker|reloadable]: reload.zs}
[SERVER_STARTED][SERVER][INFO] [reloadable | SIDE_CLIENT]: Skipping file {[0:crafttweaker]: reuse.zs} as we are currently loading with a different loader
[SERVER_STARTED][SERVER][INFO] [reloadable | SIDE_CLIENT]: Skipping file {[0:crafttweaker]: test.zs} as we are currently loading with a different loader
[SERVER_STARTED][SERVER][INFO] [reloadable | SIDE_CLIENT]: Skipping file {[0:crafttweaker]: testDelay.zs} as we are currently loading with a different loader
[SERVER_STARTED][SERVER][INFO] Completed script loading in: 19ms
[SERVER_STARTED][SERVER][ERROR] Exception occurred in a catenation task, stopping the catenation...
java.lang.NullPointerException
	at Functions.throwException(functions.zs:7)
	at CrafttweakerReloadableReload3.apply(reload.zs:10)
	at youyihj.zenutils.impl.util.catenation.InstantTask.run(InstantTask.java:21)
	at youyihj.zenutils.api.util.catenation.Catenation.tick(Catenation.java:48)
	at youyihj.zenutils.impl.util.catenation.CatenationManager.lambda$onWorldTick$0(CatenationManager.java:31)
	at youyihj.zenutils.impl.util.catenation.CatenationManager$$Lambda$1123.000000001A55B750.test(Unknown Source)
	at java.util.Collection.removeIf(Collection.java:414)
	at youyihj.zenutils.impl.util.catenation.CatenationManager.onWorldTick(CatenationManager.java:31)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_53_CatenationManager_onWorldTick_WorldTickEvent.invoke(.dynamic)
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
	at net.minecraftforge.fml.common.FMLCommonHandler.onPreWorldTick(FMLCommonHandler.java:287)
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:752)
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668)
	at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:185)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
	at java.lang.Thread.run(Thread.java:813)

Can you test whether these scripts can dump stack trace, or post your test scripts?

Seems like this happen when VanillaFix or LoliAMS recovering from crash.
So, probably, to reproduce i need:

  1. Cause fatal error inside catenation (usually error that cause crash from mod)
  2. Dropped to main menu, enter world again
  3. Spawn same error with catenation again, but this time no stack trace

I will probably try to reproduce this later.

Since this issue happens exceptionally rare, i could close issue. Thank you for your utils!