[SPIGOT-4583] Unexpected NullPointerExceptions with API objects Created: 15/Jan/19  Updated: 16/Jan/19  Resolved: 15/Jan/19

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

Type: Bug Priority: Major
Reporter: LeSeulArtichaut Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: 1.13.2, bukkit, nullpointerexception, spigot
Environment:

MacBook Pro 9.2 (2012)
MacOS Mojave 10.14.2

Hardware:
Intel Core i7 2.9GHz Processor
1600MHz DDR3 RAM
Intel HD Graphics 4000 GPU

Java:
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

JVM:
Ran server with -Xms1G -Xmx2G -Dfile.encoding=UTF-8 JVM args


Version: 1.13.2-R0.1-SNAPSHOT
Guidelines Read: Yes

 Description   

While running working code, a NullPointerException randomly pops off.
This happened me in two different periods with two different methods, first with Bukkit#getScoreboardManager(), secondly with World#getTime(), but both times in a scheduled thread.
The error happens during a random period, doesn't disappear after relaunching the server, but disappears as randomly as it appeared.

I'll report any new appearance of the bug if I get another one, and with the more details I can.

Appearance:

Loaded my plugin at 22:41:36.
Logged in at 22:41:36.
The error appeared at 22:41:44 and lasted until reload at 22:42:38.
The code worked before and after the appearance of the bug without modification.

Traceback example

[22:42:23 WARN]: [Plugin] Task #2 for Plugin v0.1 generated an exception
 java.lang.NullPointerException: null
 at fr.artichaut.plugin.PluginInstance.refreshScoreboard(PluginInstancejava:25) ~[?:?]
 at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftTask.run(CraftTask.java:81) ~[spigot-1.13.2.jar:git-Spigot-518206a-a5b9c7b]
 atorg.bukkit.craftbukkit.v1_13_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:391) [spigot-1.13.2.jar:git-Spigot-518206a-a5b9c7b]
 at net.minecraft.server.v1_13_R2.MinecraftServer.b(MinecraftServer.java:888) [spigot-1.13.2.jar:git-Spigot-518206a-a5b9c7b]
 at net.minecraft.server.v1_13_R2.DedicatedServer.b(DedicatedServer.java:417) [spigot-1.13.2.jar:git-Spigot-518206a-a5b9c7b]
 at net.minecraft.server.v1_13_R2.MinecraftServer.a(MinecraftServer.java:830) [spigot-1.13.2.jar:git-Spigot-518206a-a5b9c7b]
 at net.minecraft.server.v1_13_R2.MinecraftServer.run(MinecraftServer.java:728) [spigot-1.13.2.jar:git-Spigot-518206a-a5b9c7b]
 at java.lang.Thread.run(Thread.java:844) [?:?]

(The method which threw the exception was here World#getTime())

 

Thanks a lot for considering this issue.
Sincerely,
LeSeulArtichaut



 Comments   
Comment by md_5 [ 16/Jan/19 ]

If random NPEs are appearing completely unrelated to your code, whilst executing your code (which I highly doubt), then its going to be a Spigot/hardware bug anyway.

 

But I would still bet its line 25 of your code and world is null.

Comment by LeSeulArtichaut [ 16/Jan/19 ]

The problem is that the error appears completely randomly and doesn’t seem to be related to the code, since the bug disapears without any modifications to the code...
This is also why I wasn’t able to give more information about the issue...

Comment by md_5 [ 15/Jan/19 ]

Need reproduction code, that error is in your plugin

Generated at Sat Dec 13 13:42:53 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.