Crashed again when ticking Assassin (#214 returned)
sandtechnology opened this issue ยท 9 comments
https://paste.ubuntu.com/p/6Yp3JSMmW5/
Look like is entirely is the same as #214
Mod Version: 1.15.2-2.1.10
Could you please describe exactly what you did to cause this?
Other people have mentioned that they've had it happen with Waystone's Warpstone, which I've not been able to reproduce.
Could you please describe exactly what you did to cause this?
Other people have mentioned that they've had it happen with Waystone's Warpstone, which I've not been able to reproduce.
My players have crashed again for five times, and all crashes are by ticking Assassin, they said when teleporting to another world is more likely will crash, but I'm no sure how to reproduce this, in this time the only thing I can figure out is teleporting cause it.
I have check the crash report and find it encounter NPE in method setLookPositionWithEntity (func_75651_a), and the only value could be null is attacker.getAttackTarget().
So I will add null check for attacker.getAttackTarget() to see if it's still happening.
I have check the crash report and find it encounter NPE in method setLookPositionWithEntity (func_75651_a), and the only value could be null is attacker.getAttackTarget().
So I will add null check for attacker.getAttackTarget() to see if it's still happening.
Also, the IDE tips me this.attacker.getLookController()!=null
is useless since is inherited from MobEntity which will initialize in constructor, so I remove it.
You're very much correct. I just added it as an additional debug check, when asking DivineAspect in #214 to test out my previous attempt at a fix.
If you could try out the new Jenkins build with another attempted fix, that would be very much appreciated!
https://jenkins.girafi.dk/job/Team%20Metallurgy%20Mods/job/Atum%202/job/Atum%202%201.15.2%20Jenkins/40/
You're very much correct. I just added it as an additional debug check, when asking DivineAspect in #214 to test out my previous attempt at a fix.
If you could try out the new Jenkins build with another attempted fix, that would be very much appreciated!
https://jenkins.girafi.dk/job/Team%20Metallurgy%20Mods/job/Atum%202/job/Atum%202%201.15.2%20Jenkins/40/
I'm sorry but I must pointed out just check if entity is null in setLookPositionWithEntity method is completely useless, if you check the vanilla code, you can see is using the value from attacker.getAttackTarget()
almost everywhere in tick method, and it will check if attacker.getAttackTarget()
is null before ticking (shouldContinueExecuting
method).
I'm not sure why attacker.getAttackTarget()
is null while ticking, but the most best way for me is just simply add checking like this:
public static class AssassinMeleeAttackGoal extends MeleeAttackGoal
....
@Override
public void tick() {
if (this.attacker != null&&attacker.getAttackTarget() != null) {
super.tick();
}
}
...
And the problem solved, I haven't meet crash again after this change.
If you wish I could make a PR for fixing this.
I honestly thought I already had that null check there before, which was why I decided to try something else.
I'm confused why the crash is evening happening in the first place, as there is already null checks for the attack target in shouldExecute & shouldContinueExecuting.
The new fix is available in https://jenkins.girafi.dk/job/Team%20Metallurgy%20Mods/job/Atum%202/job/Atum%202%201.15.2%20Jenkins/41/
My players reported there doesn't have any crashes since I added attacker.getAttackTarget()!=null
, so it's time to close this issue, thanks for helping!
But just like you, I still very confused about why this value will be null...May be just because it changed by some mods threads, so I digging out Waystone code, and there are using vanilla method for teleporting: https://github.com/blay09/Waystones/blob/5c87e039db716c9915d1fa30964b6e4dd88bb7e5/src/main/java/net/blay09/mods/waystones/core/PlayerWaystoneManager.java#L213
So I dig into teleport code, I found it will remove entity in this world when cross-world teleporting, and then I check execute time, the result is anytime and is an-sync:https://github.com/blay09/Waystones/blob/5c87e039db716c9915d1fa30964b6e4dd88bb7e5/src/main/java/net/blay09/mods/waystones/network/message/SelectWaystoneMessage.java#L32
So the rare racing problem is there, they received a Teleport packet from network thread, and it do the teleport which executed by MinecraftServer class but on Network thread, causing an-sync entity remove here, at the same time the execution is between shouldContinueExecuting
and tick
method, causing attacker.getAttackTarget()
becomes null.
But is just the result by my digging, it may have something wrong here, but is the result for me.
And I found is wrong, it will be add to the queue waiting next tick, now I have no idea.....