[SPIGOT-5867] NPE during shutdown when rcon enabled with no password Created: 27/Jun/20  Updated: 02/Jul/20  Resolved: 02/Jul/20

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Ross Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File NPE_player_join_spam_during_shutdown.txt    
Version: CraftBukkit version git-Spigot-6f4ff1b-983305b (MC: 1.16.1)
Guidelines Read: Yes

 Description   

This is major because this NPE prevents the server from stopping and it has to be manually killed. I have not yet waited long enough before killing the process to see if a watchdog will cleanup the process or not.

 

The error occurs while plugins are shutting down, it may be plugin related but there is nothing in the stack trace to indicate that.

 

This error happens once or more

java.lang.IllegalStateException: AsyncPlayerPreLoginEvent cannot be triggered asynchronously from primary server thread.java.lang.IllegalStateException: AsyncPlayerPreLoginEvent cannot be triggered asynchronously from primary server thread. at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:568) ~[spigot-1.16.1.jar:git-Spigot-6f4ff1b-983305b] at net.minecraft.server.v1_16_R1.LoginListener$LoginHandler.fireEvents(LoginListener.java:270) ~[spigot-1.16.1.jar:git-Spigot-6f4ff1b-983305b] at net.minecraft.server.v1_16_R1.LoginListener$2.run(LoginListener.java:220) [spigot-1.16.1.jar:git-Spigot-6f4ff1b-983305b]

 

Then world / player save completes and the last log line is

[21:52:13] [Server thread/ERROR]: java.lang.NullPointerException

 



 Comments   
Comment by Ross [ 02/Jul/20 ]

My server is no longer hanging on stop after setting enable-rcon=false

Comment by Ross [ 01/Jul/20 ]

I have a repro. The dangling NPE is caused by setting enable-rcon=true (in server.properties) while not having an rcon password configured - this causes "No rcon password set in server.properties, rcon disabled!" at startup and NPE at shutdown.

This NPE does not appear to be what is causing my server hang on shutdown - or at least not on my test server- so my search continues for that.

 

 

Comment by Ross [ 28/Jun/20 ]

Well, the hang forever happened again after the initial surge died down and I don't think people were spamming in - but there was no NPE this time. Maybe a non-daemon thread somewhere.

Comment by md_5 [ 28/Jun/20 ]

I don't know, the point is I need to be able to experience the same issue on my PC to be able to rule it out.

I'm not convinced the last NPE is from players spam connecting which is why I would like you to test the same configuration but without spam connecting

Comment by Ross [ 28/Jun/20 ]

How about this - tell me the command line(s) you'd like me to run against the process when it happens and i'll get the output to you.

Comment by md_5 [ 27/Jun/20 ]

Even if that is the case me and other developers don't have the luxury of people 'spam connecting' to our servers, so we need a controlled way to reproduce it.

Comment by Ross [ 27/Jun/20 ]

I understand that, but my point is the repro of it happening has been 100% when people are spam connecting.

Comment by md_5 [ 27/Jun/20 ]

The cut off NPE is not the same as the others - note the different threads

Comment by Ross [ 27/Jun/20 ]

The problem only occurs when people are spam connecting during shutdown. I don't recall running into it through the many other restarts I've done setting up the server and pregenerating for 2 days restarting every 30 min. I'll try to get a heap/thread dump one of these times... i'll have to lookup how to trigger one of those

edit:
Actually - that's not entirely true, it happened at least twice come to think of it. One time it was hung for 6 hours before I noticed - i'll see if that log has anything more useful in it.

Comment by md_5 [ 27/Jun/20 ]

I suggest you try and replicate the last line only, for example by running with your worlds on a non-public server

Comment by md_5 [ 27/Jun/20 ]

java.lang.IllegalStateException: AsyncPlayerPreLoginEvent cannot be 
triggered asynchronously from primary server 
thread.java.lang.IllegalStateException: AsyncPlayerPreLoginEvent cannot 
be triggered asynchronously from primary server thread. at 
org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:568)
 ~[spigot-1.16.1.jar:git-Spigot-6f4ff1b-983305b] at net.minecraft.server.v1_16_R1.LoginListener$LoginHandler.fireEvents(LoginListener.java:270) ~[spigot-1.16.1.jar:git-Spigot-6f4ff1b-983305b] at net.minecraft.server.v1_16_R1.LoginListener$2.run(LoginListener.java:220) [spigot-1.16.1.jar:git-Spigot-6f4ff1b-983305b] 

This error is not preventing your server from stopping. It is from a separate thread.

It is the last cut off line we need information from.

Generated at Thu Dec 18 06:19:06 UTC 2025 using Jira 10.3.15#10030015-sha1:909cc43d292ca09e774c1a243d9819be3f2628cd.