New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client NPE in tablist #1360

Closed
CCCCarsten opened this Issue Dec 17, 2017 · 30 comments

Comments

Projects
None yet
6 participants
@CCCCarsten

CCCCarsten commented Dec 17, 2017

Hi,
server: Bungeecord (latest), Spigot 1.12.2 with ProtocolSupport (latest, 1.8.8 - 1.12.2).
Client: 1.12.2 version
It seems that citizens causes an issue on the client side:

Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at h.a(SourceFile:47)
at bib.az(SourceFile:991)
at bib.a(SourceFile:419)
at net.minecraft.client.main.Main.main(SourceFile:123)
Caused by: java.lang.NullPointerException
at brz.a(SourceFile:482)
at ic.a(SourceFile:67)
at ic.a(SourceFile:14)
at hv$1.run(SourceFile:13)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at h.a(SourceFile:46)
... 3 more

This error appears near every second and causes lags on the client side.
Logfile of server dooesn't show errors.

@seema84

This comment has been minimized.

Show comment
Hide comment
@seema84

seema84 Dec 20, 2017

can confirm

seema84 commented Dec 20, 2017

can confirm

@seema84

This comment has been minimized.

Show comment
Hide comment
@seema84

seema84 Feb 7, 2018

[main/FATAL]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_25]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_25]
at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?]
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1086) [bib.class:?]
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397) [bib.class:?]
at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.func_147237_a(NetHandlerPlayClient.java:558) ~[brz.class:?]
at net.minecraft.network.play.server.SPacketSpawnPlayer.func_148833_a(SourceFile:67) ~[ic.class:?]
at net.minecraft.network.play.server.SPacketSpawnPlayer.func_148833_a(SourceFile:14) ~[ic.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:20) ~[hv$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_25]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_25]
at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?]
... 9 more

seema84 commented Feb 7, 2018

[main/FATAL]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_25]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_25]
at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?]
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1086) [bib.class:?]
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397) [bib.class:?]
at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.network.NetHandlerPlayClient.func_147237_a(NetHandlerPlayClient.java:558) ~[brz.class:?]
at net.minecraft.network.play.server.SPacketSpawnPlayer.func_148833_a(SourceFile:67) ~[ic.class:?]
at net.minecraft.network.play.server.SPacketSpawnPlayer.func_148833_a(SourceFile:14) ~[ic.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:20) ~[hv$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_25]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_25]
at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?]
... 9 more

@seema84

This comment has been minimized.

Show comment
Hide comment
@seema84

seema84 Feb 7, 2018

its only if citizens player npc are loaded/unloaded

seema84 commented Feb 7, 2018

its only if citizens player npc are loaded/unloaded

@mcmonkey4eva

This comment has been minimized.

Show comment
Hide comment
@mcmonkey4eva

mcmonkey4eva Mar 9, 2018

Member

Sounds like an issue with Bungee/ProtocolSupport?

We aren't equipped to diagnose or handle clientside errors, especially if they only replicate when sent through relay...

Member

mcmonkey4eva commented Mar 9, 2018

Sounds like an issue with Bungee/ProtocolSupport?

We aren't equipped to diagnose or handle clientside errors, especially if they only replicate when sent through relay...

@seema84

This comment has been minimized.

Show comment
Hide comment
@seema84

seema84 Mar 9, 2018

I don't use Bungee and ProtocolLib but this error stay. If i remove Citizens the error will stop.

seema84 commented Mar 9, 2018

I don't use Bungee and ProtocolLib but this error stay. If i remove Citizens the error will stop.

@CCCCarsten

This comment has been minimized.

Show comment
Hide comment
@CCCCarsten

CCCCarsten Mar 9, 2018

Agree. It is very easy to close a ticket and more difficult to solve it.

CCCCarsten commented Mar 9, 2018

Agree. It is very easy to close a ticket and more difficult to solve it.

@seema84

This comment has been minimized.

Show comment
Hide comment
@seema84

seema84 Mar 9, 2018

I get this error also on a fresh Spigot Server (last Build) and only one Plugin (Citizens).
Thats definitive a Citizens problem.

20:31:41 game   info [19:31:41] [main/INFO]: [CHAT] You created Peter.
20:31:43 game   info [19:31:43] [main/FATAL]: Error executing task
20:31:43 game   info java.util.concurrent.ExecutionException: java.lang.NullPointerException
20:31:43 game   info at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_25]
20:31:43 game   info at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_25]
20:31:43 game   info at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?]
20:31:43 game   info at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1086) [bib.class:?]
20:31:43 game   info at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397) [bib.class:?]
20:31:43 game   info at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?]
20:31:43 game   info at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
20:31:43 game   info at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
20:31:43 game   info at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
20:31:43 game   info at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
20:31:43 game   info at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
20:31:43 game   info at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
20:31:43 game   info Caused by: java.lang.NullPointerException
20:31:43 game   info at net.minecraft.client.network.NetHandlerPlayClient.func_147237_a(NetHandlerPlayClient.java:558) ~[brz.class:?]
20:31:43 game   info at net.minecraft.network.play.server.SPacketSpawnPlayer.func_148833_a(SourceFile:67) ~[ic.class:?]
20:31:43 game   info at net.minecraft.network.play.server.SPacketSpawnPlayer.func_148833_a(SourceFile:14) ~[ic.class:?]
20:31:43 game   info at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:20) ~[hv$1.class:?]
20:31:43 game   info at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_25]
20:31:43 game   info at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_25]
20:31:43 game   info at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?]
20:31:43 game   info ... 9 more

seema84 commented Mar 9, 2018

I get this error also on a fresh Spigot Server (last Build) and only one Plugin (Citizens).
Thats definitive a Citizens problem.

20:31:41 game   info [19:31:41] [main/INFO]: [CHAT] You created Peter.
20:31:43 game   info [19:31:43] [main/FATAL]: Error executing task
20:31:43 game   info java.util.concurrent.ExecutionException: java.lang.NullPointerException
20:31:43 game   info at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_25]
20:31:43 game   info at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_25]
20:31:43 game   info at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?]
20:31:43 game   info at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1086) [bib.class:?]
20:31:43 game   info at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397) [bib.class:?]
20:31:43 game   info at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?]
20:31:43 game   info at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
20:31:43 game   info at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
20:31:43 game   info at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
20:31:43 game   info at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
20:31:43 game   info at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
20:31:43 game   info at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
20:31:43 game   info Caused by: java.lang.NullPointerException
20:31:43 game   info at net.minecraft.client.network.NetHandlerPlayClient.func_147237_a(NetHandlerPlayClient.java:558) ~[brz.class:?]
20:31:43 game   info at net.minecraft.network.play.server.SPacketSpawnPlayer.func_148833_a(SourceFile:67) ~[ic.class:?]
20:31:43 game   info at net.minecraft.network.play.server.SPacketSpawnPlayer.func_148833_a(SourceFile:14) ~[ic.class:?]
20:31:43 game   info at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:20) ~[hv$1.class:?]
20:31:43 game   info at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_25]
20:31:43 game   info at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_25]
20:31:43 game   info at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?]
20:31:43 game   info ... 9 more
@mcmonkey4eva

This comment has been minimized.

Show comment
Hide comment
@mcmonkey4eva

mcmonkey4eva Mar 10, 2018

Member

Will reopen since it's replicated without interference.

Do note that it may be difficult to get any solution here, as we don't have any tooling to deal with clientside errors.

Member

mcmonkey4eva commented Mar 10, 2018

Will reopen since it's replicated without interference.

Do note that it may be difficult to get any solution here, as we don't have any tooling to deal with clientside errors.

@mcmonkey4eva mcmonkey4eva reopened this Mar 10, 2018

@seema84

This comment has been minimized.

Show comment
Hide comment
@seema84

seema84 Mar 10, 2018

I pretty shure you can fix this.
On some Server without Citizens but with NPC's i dont get this null errors.

seema84 commented Mar 10, 2018

I pretty shure you can fix this.
On some Server without Citizens but with NPC's i dont get this null errors.

@mcmonkey4eva

This comment has been minimized.

Show comment
Hide comment
@mcmonkey4eva

mcmonkey4eva Mar 11, 2018

Member

Are you running Forge / similar modded client?

Can you get an error log generated with a Vanilla client?

Member

mcmonkey4eva commented Mar 11, 2018

Are you running Forge / similar modded client?

Can you get an error log generated with a Vanilla client?

@fullwall

This comment has been minimized.

Show comment
Hide comment
@fullwall

fullwall Mar 11, 2018

Member

The error seems likely to be this line this.getPlayerInfo(packetIn.getUniqueId()).getGameProfile()
which would be an issue with the tablist.

Member

fullwall commented Mar 11, 2018

The error seems likely to be this line this.getPlayerInfo(packetIn.getUniqueId()).getGameProfile()
which would be an issue with the tablist.

@fullwall

This comment has been minimized.

Show comment
Hide comment
@fullwall

fullwall Mar 11, 2018

Member

Can you paste your config

Member

fullwall commented Mar 11, 2018

Can you paste your config

@seema84

This comment has been minimized.

Show comment
Hide comment
@seema84

seema84 Mar 11, 2018

without forge:

19:03:32 bjb Client thread info [CHAT] You created Hans.
19:03:33 bib Client thread fatal Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at h.a(SourceFile:47) at bib.az(SourceFile:991) at bib.a(SourceFile:419) at net.minecraft.client.main.Main.main(SourceFile:123) Caused by: java.lang.NullPointerException at brz.a(SourceFile:482) at ic.a(SourceFile:67) at ic.a(SourceFile:14) at hv$1.run(SourceFile:13) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at h.a(SourceFile:46) ... 3 more

seema84 commented Mar 11, 2018

without forge:

19:03:32 bjb Client thread info [CHAT] You created Hans.
19:03:33 bib Client thread fatal Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at h.a(SourceFile:47) at bib.az(SourceFile:991) at bib.a(SourceFile:419) at net.minecraft.client.main.Main.main(SourceFile:123) Caused by: java.lang.NullPointerException at brz.a(SourceFile:482) at ic.a(SourceFile:67) at ic.a(SourceFile:14) at hv$1.run(SourceFile:13) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at h.a(SourceFile:46) ... 3 more
@seema84

This comment has been minimized.

Show comment
Hide comment
@seema84

seema84 Mar 11, 2018

i get this error when a npc load/unload or i create a new one

@fullwall
its also on a testserver with a fresh config

seema84 commented Mar 11, 2018

i get this error when a npc load/unload or i create a new one

@fullwall
its also on a testserver with a fresh config

@fullwall

This comment has been minimized.

Show comment
Hide comment
@fullwall

fullwall Mar 11, 2018

Member

What about your saves.yml?

Member

fullwall commented Mar 11, 2018

What about your saves.yml?

@seema84

This comment has been minimized.

Show comment
Hide comment
@seema84

seema84 Mar 11, 2018

you cant reproduce and test it?

seema84 commented Mar 11, 2018

you cant reproduce and test it?

@fullwall

This comment has been minimized.

Show comment
Hide comment
@fullwall
Member

fullwall commented Mar 12, 2018

No

@seema84

This comment has been minimized.

Show comment
Hide comment

seema84 commented Mar 12, 2018

@fullwall fullwall changed the title from client side to NPE client exception in tablist Mar 15, 2018

@fullwall fullwall changed the title from NPE client exception in tablist to Client NPE in tablist Mar 15, 2018

@seema84

This comment has been minimized.

Show comment
Hide comment
@seema84

seema84 Apr 16, 2018

what do you need to reproduce this error?

seema84 commented Apr 16, 2018

what do you need to reproduce this error?

@daipenger

This comment has been minimized.

Show comment
Hide comment
@daipenger

daipenger Apr 24, 2018

I have not looked at your source code. However I do have a strong suspicion what is going on and how to fix it (pretty much) after examining the client side of things:
You are sending a SPacketSpawnPlayer, immediately followed by SPacketPlayerListItem with a REMOVE_PLAYER action, am I correct? (that's how these packets have been renamed in forge, but it should be somewhat equivalent in your code)
It turns out that the client code apparently buffers all packets and executes them with multiple threads/not in order. (didn't exactly check that, just an educated guess from the stacktrace) So in some cases the SPacketPlayerListItem is processed before SPacketSpawnPlayer which removes network information that the processing method of the SPacketSpawnPlayer needs. Therefore the NPE.

So, as a workaround can you try out delaying the SPacketPlayerListItem by one tick?

daipenger commented Apr 24, 2018

I have not looked at your source code. However I do have a strong suspicion what is going on and how to fix it (pretty much) after examining the client side of things:
You are sending a SPacketSpawnPlayer, immediately followed by SPacketPlayerListItem with a REMOVE_PLAYER action, am I correct? (that's how these packets have been renamed in forge, but it should be somewhat equivalent in your code)
It turns out that the client code apparently buffers all packets and executes them with multiple threads/not in order. (didn't exactly check that, just an educated guess from the stacktrace) So in some cases the SPacketPlayerListItem is processed before SPacketSpawnPlayer which removes network information that the processing method of the SPacketSpawnPlayer needs. Therefore the NPE.

So, as a workaround can you try out delaying the SPacketPlayerListItem by one tick?

@mibby

This comment has been minimized.

Show comment
Hide comment
@mibby

mibby Jun 7, 2018

I can confirm, I am also experiencing this issue with Citizens. Error is coming from the client logs and repeatedly occurs hundreds of times while online.

[20:29:11] [main/FATAL] [net.minecraft.client.Minecraft]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_25]
	at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_25]
	at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?]
	at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1086) [bib.class:?]
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397) [bib.class:?]
	at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
	at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
Caused by: java.lang.NullPointerException
	at net.minecraft.client.network.NetHandlerPlayClient.func_147237_a(NetHandlerPlayClient.java:558) ~[brz.class:?]
	at net.minecraft.network.play.server.SPacketSpawnPlayer.func_148833_a(SourceFile:67) ~[ic.class:?]
	at net.minecraft.network.play.server.SPacketSpawnPlayer.func_148833_a(SourceFile:14) ~[ic.class:?]
	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:20) ~[hv$1.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_25]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_25]
	at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?]
	... 9 more

Client is on MC 1.12.2.
Paper dev 1441 (Spigot 1.12.2)
Citizens dev 1545.

mibby commented Jun 7, 2018

I can confirm, I am also experiencing this issue with Citizens. Error is coming from the client logs and repeatedly occurs hundreds of times while online.

[20:29:11] [main/FATAL] [net.minecraft.client.Minecraft]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_25]
	at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_25]
	at net.minecraft.util.Util.func_181617_a(SourceFile:47) [h.class:?]
	at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1086) [bib.class:?]
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:397) [bib.class:?]
	at net.minecraft.client.main.Main.main(SourceFile:123) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
	at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
Caused by: java.lang.NullPointerException
	at net.minecraft.client.network.NetHandlerPlayClient.func_147237_a(NetHandlerPlayClient.java:558) ~[brz.class:?]
	at net.minecraft.network.play.server.SPacketSpawnPlayer.func_148833_a(SourceFile:67) ~[ic.class:?]
	at net.minecraft.network.play.server.SPacketSpawnPlayer.func_148833_a(SourceFile:14) ~[ic.class:?]
	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:20) ~[hv$1.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_25]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_25]
	at net.minecraft.util.Util.func_181617_a(SourceFile:46) ~[h.class:?]
	... 9 more

Client is on MC 1.12.2.
Paper dev 1441 (Spigot 1.12.2)
Citizens dev 1545.

@fullwall

This comment has been minimized.

Show comment
Hide comment
@fullwall

fullwall Jun 7, 2018

Member

The latest build uses @daipenger's suggestion. Does this help the issue?

Member

fullwall commented Jun 7, 2018

The latest build uses @daipenger's suggestion. Does this help the issue?

@seema84

This comment has been minimized.

Show comment
Hide comment
@seema84

seema84 Jun 7, 2018

no don't help
the error stay also when is set "tablist: disable: false"

seema84 commented Jun 7, 2018

no don't help
the error stay also when is set "tablist: disable: false"

@daipenger

This comment has been minimized.

Show comment
Hide comment
@daipenger

daipenger Jun 10, 2018

I have now done further and more sound analysis why that error occurs. Turns out that my first conclusion was incorrect. Recall that I said that packets are processed concurrently which is true as the network socket puts packets in a queue that are then processed by the main minecraft thread. But that does also mean that the processing of packets is still only one thread and therefore in order.
So ecd6df2 is sadly totally useless.

I now completely monitored all SPacketPlayerListItem and SPacketSpawnPlayer packets. (Packet numbers 0x2E and 0x05, respectively) and found the culprit:

Citizens does not obey the protocol specs!

Normally you expect sequences of the following form:
(1) SPacketPlayerListItem with the add player action (action number 0)
(2) SPacketSpawnPlayer (which needs the saved state from (1)! If (1) wasn't sent, the NPE will happen! See http://wiki.vg/Protocol#Spawn_Player)
(3) SPacketPlayerListItem with the remove player action (action number 4)

Citizens sometimes (on apparently always the same NPCs, so there should be some NPC setting that causes it) does not send a (1), but instead a SPacketPlayerListItem with an update gamemode action. (action number 1)
In addition I also found out that Citizens sends (3) twice. If you can find out why, you should fix that, too.

I may continue to dig a bit further but I now hope that it is enough for you to fix that bug once and for all.

daipenger commented Jun 10, 2018

I have now done further and more sound analysis why that error occurs. Turns out that my first conclusion was incorrect. Recall that I said that packets are processed concurrently which is true as the network socket puts packets in a queue that are then processed by the main minecraft thread. But that does also mean that the processing of packets is still only one thread and therefore in order.
So ecd6df2 is sadly totally useless.

I now completely monitored all SPacketPlayerListItem and SPacketSpawnPlayer packets. (Packet numbers 0x2E and 0x05, respectively) and found the culprit:

Citizens does not obey the protocol specs!

Normally you expect sequences of the following form:
(1) SPacketPlayerListItem with the add player action (action number 0)
(2) SPacketSpawnPlayer (which needs the saved state from (1)! If (1) wasn't sent, the NPE will happen! See http://wiki.vg/Protocol#Spawn_Player)
(3) SPacketPlayerListItem with the remove player action (action number 4)

Citizens sometimes (on apparently always the same NPCs, so there should be some NPC setting that causes it) does not send a (1), but instead a SPacketPlayerListItem with an update gamemode action. (action number 1)
In addition I also found out that Citizens sends (3) twice. If you can find out why, you should fix that, too.

I may continue to dig a bit further but I now hope that it is enough for you to fix that bug once and for all.

@mibby

This comment has been minimized.

Show comment
Hide comment
@mibby

mibby Jun 19, 2018

@fullwall Any update on this issue after @daipenger's findings? :(

mibby commented Jun 19, 2018

@fullwall Any update on this issue after @daipenger's findings? :(

@mcmonkey4eva

This comment has been minimized.

Show comment
Hide comment
@mcmonkey4eva

mcmonkey4eva Jun 26, 2018

Member

EDIT: Disregard this post

@daipenger this is not the fault of game mode packet -> that is only sent if you've set the gamemode explicitly by command.

I've gotten this error replicating locally, and have confirmed it still happens when game mode is not specifically set.

EDIT: it may actually be from the game mode packet? It seems to be sent when it shouldn't be

Member

mcmonkey4eva commented Jun 26, 2018

EDIT: Disregard this post

@daipenger this is not the fault of game mode packet -> that is only sent if you've set the gamemode explicitly by command.

I've gotten this error replicating locally, and have confirmed it still happens when game mode is not specifically set.

EDIT: it may actually be from the game mode packet? It seems to be sent when it shouldn't be

@mcmonkey4eva

This comment has been minimized.

Show comment
Hide comment
@mcmonkey4eva

mcmonkey4eva Jun 26, 2018

Member

EDIT: Disregard this post

Replication notes:

Client error:

java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at h.a(SourceFile:47)
	at bib.az(SourceFile:991)
	at bib.a(SourceFile:419)
	at net.minecraft.client.main.Main.main(SourceFile:123)
Caused by: java.lang.NullPointerException
	at brz.a(SourceFile:482)
	at ic.a(SourceFile:67)
	at ic.a(SourceFile:14)
	at hv$1.run(SourceFile:13)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at h.a(SourceFile:46)
	... 3 more

Timing aligns with send of two PacketPlayOutPlayerInfo{action=REMOVE_PLAYER,uuid=<mynpc>} packets.
Which were sent when player-type NPC was removed.

Note that only player spawn and player info packets were being tracked at that point. If any other packet was involved or sent in that time, i didn't see it.

EDIT: actually, timing was mismeasured. Going to recalculate.

Member

mcmonkey4eva commented Jun 26, 2018

EDIT: Disregard this post

Replication notes:

Client error:

java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at h.a(SourceFile:47)
	at bib.az(SourceFile:991)
	at bib.a(SourceFile:419)
	at net.minecraft.client.main.Main.main(SourceFile:123)
Caused by: java.lang.NullPointerException
	at brz.a(SourceFile:482)
	at ic.a(SourceFile:67)
	at ic.a(SourceFile:14)
	at hv$1.run(SourceFile:13)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at h.a(SourceFile:46)
	... 3 more

Timing aligns with send of two PacketPlayOutPlayerInfo{action=REMOVE_PLAYER,uuid=<mynpc>} packets.
Which were sent when player-type NPC was removed.

Note that only player spawn and player info packets were being tracked at that point. If any other packet was involved or sent in that time, i didn't see it.

EDIT: actually, timing was mismeasured. Going to recalculate.

mcmonkey4eva added a commit to mcmonkey4eva/Citizens2 that referenced this issue Jun 27, 2018

Fix CitizensDev#1360 - don't missend player spawn packets
Player spawn packets were improperly sent by the Minecraft internals in early NPC spawn sequence, when they are not valid to be sent yet. This patch blocks their sending until the tracker system is pushed onto the NPC. Tested and functional.
@mcmonkey4eva

This comment has been minimized.

Show comment
Hide comment
@mcmonkey4eva

mcmonkey4eva Jun 27, 2018

Member

Spent about 10 hours just now figuring this out.
Eventually traced it down to the Minecraft internals improperly sending the spawn packet way too early (during the initial spawn sequence), rather than waiting for the packet send that Citizens will do later.
(Which means it sent twice: once brokenly, then once validly).

I have created a fix in #1525 that patches this by blocking the initial missend.

I've confirmed the error no longer occurs with this patch.

Member

mcmonkey4eva commented Jun 27, 2018

Spent about 10 hours just now figuring this out.
Eventually traced it down to the Minecraft internals improperly sending the spawn packet way too early (during the initial spawn sequence), rather than waiting for the packet send that Citizens will do later.
(Which means it sent twice: once brokenly, then once validly).

I have created a fix in #1525 that patches this by blocking the initial missend.

I've confirmed the error no longer occurs with this patch.

@seema84

This comment has been minimized.

Show comment
Hide comment
@seema84

seema84 Jun 27, 2018

"I've confirmed the error no longer occurs with this patch."

I can't confirm. I use the build #1​54​8 and get this error when i create a new player npc or move in a world with existing npc's (when player are load or unload).

seema84 commented Jun 27, 2018

"I've confirmed the error no longer occurs with this patch."

I can't confirm. I use the build #1​54​8 and get this error when i create a new player npc or move in a world with existing npc's (when player are load or unload).

@mcmonkey4eva

This comment has been minimized.

Show comment
Hide comment
@mcmonkey4eva

mcmonkey4eva Jun 27, 2018

Member

There is not a release build of my patch currently available. The fix is pending at #1525

Member

mcmonkey4eva commented Jun 27, 2018

There is not a release build of my patch currently available. The fix is pending at #1525

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment