Reliquary Reincarnations

Reliquary Reincarnations

51M Downloads

Game Crashes when wearing the mob charm when hitting a Zombie.

SirAron111 opened this issue · 20 comments

commented

Game Crashes when wearing the mob charm when hitting a Zombie.
It looks like there is some kind of conflict on how mobs can’t target you any more when wearing the charm and it just crashes the game. Here is a link to the error

https://pastebin.com/BVnRzGAn

It could be an error or conflict with one of the following mods I think (zombie awareness, rough mobs 2) as these do make some slight changes to ai but it definitely is the mob charm making them unable to find the player causing the crash tested it toughly.

commented

About 90% sure its not my zombie awareness mod that is of issue, not much has changed in zombie awareness for a while and I've had a friend using the charm with zombie awareness install and never had issues for months, theyd follow her around but not actually attack her and she could kill them fine.

Looking at the vanilla code that is crashing, it is concerning to see getRevengeTarget() annotated as nullable yet mojangs own code is not null checking it when its used within a method call to isOnSameTeam, which that method assumes its not null, could this be a vanilla bug that was hiding until the charm triggered the right scenario to cause a crash? Not entirely sure cant dig to deep into it at the moment.

commented

Ye I am just a Modpack maker not a modder so I am not that good at reading the error codes I was just assuming it COULD be your mod since it does a lot with the zombies and the targeting but if you say it isn’t than it probably isn’t.

All I can say it happens when wearing the charm if it turns out to be unfixable even by the mod that makes the charm I will have to disable it when I update the Modpack next time.

Forge: 14.23.5.2769
Modpack: „Dimension Zero“ Version 4.9 (current)
Reliquary-1.12.2-1.3.4.780

I spent like 3 hours finding the actual problem since one of the players reported that hitting zombies causes this problem to happen. (I than found out he had the charm in his baubles slot and it stopped crashing when I removed it.) Than I tested around a bit more to see if it also happens when it’s just ion the inventory (also happens there). And it only happens when there is more than one zombie present

commented

To narrow this down, the issue occurs in Forge 14.23.5.2769 in the Nether and in the Overworld with
both Blazes and Zombies while wearing their associated charms, with no other mods installed.

Zombies and Blazes both have a feature where if you attack one, the rest in a radius become aware of your position and attempt to attack or reach you. The issue does not occur with Zombie Pigmen, but they are in a weird class of creature that is neither naturally hostile nor utterly passive.

I have also tested it with Wither Skeletons, where it did not occur.

Spiders, Cave Spiders, and Slimes, though they can see you through walls, do not cause the issue since attacking one of these does not bring you to the attention of its companions.

commented

This same issue happens in the FTB Revelation modpack v. 2.7.0 and Forge 14.23.5.2796.

With the zombie charm, punching one zombie is fine. Punching one zombie while another is present crashes the game. This also happens with the blaze charm and blazes,

commented

I have tested this with forge 14.23.5.2796 and a few mods that I use in dev environment and definitely can't recreate. So this is a case of incompatibility with some mod that's in these packs. it would be helpful if you could narrow it down to what mod combination makes this explode. I can then take a look at whether there's something i can do to fix on Reliquary side. It's likely one of the core mods as it appears to change vanilla HurtByTarget AI.
It's probably trying to use the zombies attack target to do something, because that gets reset by logic in Reliquary. However in vanilla AI this can't explode as it makes sure there's a target before doing something with it.

commented

It may also be informative that the issue does NOT occur when creating this setup in MultiMC. However, the sky night sky "glows" when you kill any mob while wearing its charm.

commented

I created a world using MultiMC, was unable to reproduce the bug there. Then I created the "same" setup using the Twitch Launcher. Instead of creating a new world, I just copied the world save over. On my first attack on a zombie, the game crashed.

Here's the crashlog:
crash-2019-01-31_11.34.01-server.txt

commented

I apologize, but I am able to make this occur with no other mods present. I did this on my Twitch stream and the results are in my VODs, but I'm going to reproduce the results again today from scratch so that I can create a much cleaner video. However, here is a list of steps taken to reproduce the result in the quickest way possible:

  1. Install Minecraft 1.12.2
  2. Install Forge 14.23.5.2796
  3. Install Reliquary (latest)
  4. Create a Survival Minecraft World, enabling cheats (for the purpose of cheating in a zombie charm)
  5. Load the world, switch to Creative, cheat in a zombie charm, switch back to Survival
  6. Wait for more than 1 zombie to spawn nearby (making it night can cause this to occur faster)
  7. Strike 1 of the zombies with a bare hand or any other weapon that does not kill it immediately

It may also be instructional that the environment is created using the Twitch Launcher. I also have MultiMC, and will also attempt to use it to re-create a similar environment for testing.

commented

Looked through this in detail and the only way I can see this crashing is when on killing the revenge target is set and by the time the code that crashes runs there's no revenge target. So that would make it seems like it should be easy to fix, except between these two parts of code there's nothing that can run under normal conditions (including the Reliquary logic that resets attack/revenge targets) so there either isn't any revenge target and nothing runs or there's a revenge target and both these parts run without issue.
I could only see this happening if for some reason the event that reliquary handles was run in a separate thread, which definitely isn't the case with just forge.
Actually, have you got optifine running? It may mess with this as well seeing how much stuff it affects and that it actually is in the log when this bug was originally reported.

commented

I thought maybe this is specifically a Twitch Launcher problem, since it doesn't occur at all with MultiMC that I could spot. I'll admit I don't know how to set it up from barebones anymore, but since it isn't happening in your development environment, I'm curious as to whether a raw Forge install would cause it to happen or not.

But then I also realized it crashes our FTB Revelation server, too. I don't have server logs to share off-hand. We had to take extra precautions to let people know not to use them if they have them and have also disabled the recipes for all charms using tweaker scripts. I'll see if our server admin will provide the crashlog so I can upload it for you. I suspect it will show you very much the same thing.

And also, no I don't use Optifine at all.

commented

Another dev might have tracked down the issue, apparently its due to a change in forge 2777 "Stop firing LivingSetAttackTargetEvent for setRevengeTarget" which points to PR MinecraftForge/MinecraftForge#5217

Fixing it for tombstone_lite was discussed here Corail31/tombstone_lite#42 , though there isnt a commit yet to show how to fix, it might give you a lead on what to do.

Edit: though callmesabs mentioned it also happens in 2769 which is concerning.

commented

I've successfully reproduced the crash in forge 2815 with this code:

@SubscribeEvent
public void onEntityTargetedEvent(LivingSetAttackTargetEvent event) {
    if (event.getEntity() instanceof EntityZombie && event.getTarget() != null) {
        System.out.println("cancel set targets");
        ((EntityLiving)event.getEntity()).setAttackTarget(null);
        ((EntityLiving)event.getEntity()).setRevengeTarget(null);
    }
}

Had to spawn 2 zombie pigman and hit 1 to cause this crash:

java.lang.NullPointerException: Ticking entity
	at net.minecraft.entity.Entity.isOnSameTeam(Entity.java:2631)
	at net.minecraft.entity.ai.EntityAIHurtByTarget.alertOthers(EntityAIHurtByTarget.java:57)
	at net.minecraft.entity.ai.EntityAIHurtByTarget.startExecuting(EntityAIHurtByTarget.java:45)
	at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:84)
	at net.minecraft.entity.EntityLiving.updateEntityActionState(EntityLiving.java:840)
	at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2589)
	at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:647)
	at net.minecraft.entity.monster.EntityMob.onLivingUpdate(EntityMob.java:49)
	at net.minecraft.entity.monster.EntityZombie.onLivingUpdate(EntityZombie.java:246)
	at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2405)
	at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:346)
	at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:57)
	at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2171)
	at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:871)
	at net.minecraft.world.World.updateEntity(World.java:2130)
	at net.minecraft.world.World.updateEntities(World.java:1931)
	at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:643)
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:842)
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743)
	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592)
	at java.lang.Thread.run(Thread.java:748)

Pondering a forge PR solution to this.

Edit: Note to @P3pp3rF1y that it does stop the crash if i add your "!(entity instanceof EntityPigZombie)" bit of code, however I also noticed that your ItemTwilightCloak has similar targetting stopping behavior but it doesnt filter out EntityPigZombie, could that be part of the problem? I haven't fully traced your code so that might be a non issue.

commented

The real question is how that logic even gets to run because last I checked it only runs after shouldexecute is called in the ai and that has check to make sure that revengetarget is no null. And I haven’t seen a way for revengetarget to be changed in between that check and where it crashes for you. So the only explanation I have is that something runs concurrently here.

commented

Yeah I'm back to being confused why your mod could be to blame at all now.

For my example code it makes sense why it'd crash because since forge 2777+, since setRevengeTarget doesnt fire an event that can undo the setting anymore, EntityPigZombie.updateAITasks will re-set the revenge target, and then EntityAIHurtByTarget.shouldExecute will return true since revenge target is set, run EntityAIHurtByTarget.startExecuting which runs setAttackTarget which will again undo target and revenge target, which then calls alertOthers which will have both attack and revenge target null and crash.

Since my initial report, I've noticed that if I change my event to only null setAttackTarget, or if i filter out pig zombie, or if null angerTargetUUID to prevent pigzombie re-setting the revenge target, there is no crash, which your mod does all these things correctly too.

To be totally sure I just tested your mod in dev with latest forge 2815 with the zombie mob charm and active twilight cloak, hitting 2 zombie pigman next to eachother, no crash.

It MUST be another mod at fault here.

Also I've decided this isnt really forge PR worthy, its just unfortunately a huge pain to find out what mod is to blame.

commented

Just pasing by because i had the exact same problem, as long as the zombie is instakilled nothing happens , but when he's not, the game crashes. I read all the comments and i cant really find a fix at all. You guys said it even happens with just reliquary installed right? ( i also use zombieawareness) I really like the charm system and it took me a while to farm several of them. I'll look forward for a fix!

commented

This same issue happens in the FTB Revelation modpack v. 2.7.0 and Forge 14.23.5.2796.

With the zombie charm, punching one zombie is fine. Punching one zombie while another is present crashes the game. This also happens with the blaze charm and blazes,

Can confirm this behaviour but it does not happen every time I hit a zombie/blaze, maybe only when there is no zombie/blaze in the radius?

Crash Report https://pastebin.com/BvSJvxA0

commented

Able to reproduce with only Reliquary v1.3.4.786 and Forge 2777. Unable to reproduce on 2776 or lower. Same stack trace as other reports.

I attempted to inspect the issue with JDB. It yielded some fairly interesting results: https://hastebin.cerulan.net/exohavebuw.cs

I set a breakpoint in EntityAIHurtByTarget.startExecuting (func_75249_e), and examined the taskObject's revenge target, which was my player even though I had a mob charm equipped. I proceeded to step a single line in the debugger, and examined the revenge target again. This time, it was null. I can only guess there's an interesting race condition going on, but AFAIK the events and the AI tasks both run on the same thread (server thread)...?

Edit: upon further examination, it appears that the call to setAttackTarget in startExecuting posts the LivingSetAttackTargetEvent event, which Reliquary then handles, setting the value to null.

commented

It seems this is a well-discussed bug, and I'm afraid I don't have anything new to add except my data.

Here are my two server crash files:
crash-2019-06-05_13.40.03-server.txt
crash-2019-06-04_14.57.56-server.txt

They crashed the server but the clients were only disconnected, not CTD'd. One zombie was Infernal, the other was not.

Here are my versions:
Reliquary: Reliquary-1.12.2-1.3.4.786
Forge: forge-1.12.2-14.23.5.2838-universal

I do not use ZombieAwareness, nor OptiFine. Here is a link to my modpack's latest changelog, includes a full modlist with versions: http://enthusiasticraft.cf/modpack-update-1-4-3/

I hope you're able to get this figured out! In the meantime I'll just disable charms, no harm done. :) Thank you for all your hard work, everyone!

commented

Having the EXACT same issue! Made an extrautils mob farm (cursed earth) in overworld and every time I punch a zombie while wearing the charm while another zombie is present it crashes my server. If you read the logs it even tells you that the AI even asks "is on sameTeam?". So the above users are correct. This does not happen when I take my bauble off. Sucks... oh well :( Will just disable the charms for now.

commented

The same problem here my friend was wearing on those charm attack zombie and crashed the server I was first thinking it is sword but later on we realized it is the charm but it crashes randomly
crash-2019-07-20_07.52.15-server.txt
crash-2019-07-19_08.51.49-server.txt