The Beneath

The Beneath

22M Downloads

Server crash: NullPointerException when loading server

danielkorczak opened this issue ยท 0 comments

commented

Intro:

A hard server crash (due to running out of disk space) led to the server being unable to load on the next reboot.

Description:

A hard server crash (due to running out of disk space) led to the server being unable to load on the next reboot. When checking the stack trace, I discovered that an empty oregen.json file existed on the disk, causing https://github.com/Shinoow/The-Beneath/blob/master/src/main/java/com/shinoow/beneath/common/handler/OreGenHandler.java#L23 to prevent a fresh file from being created.

While the desired behavior is rather obvious, it's clear that the file was not written to disk correctly (due to my error), and that the application crashed with an NPE rather than a more graceful error. In my case, deleting the oregen.json file and allowing the default to be recreated fixed the issue, but only due to my sleuthing and reading of the source code.

Let me know if you have any guidance for improving the source, and I'd be happy to implement. If you don't have any preference, I'll just add a verification of the file that spits out a better error.

Crash report:

---- Minecraft Crash Report ----
// Sorry :(

Time: 2021-07-07 01:36:28 UTC
Description: Exception in server tick loop

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from The Beneath (beneath)
Caused by: java.lang.NullPointerException
    at com.google.common.collect.Streams.stream(Streams.java:63)
    at com.shinoow.beneath.common.handler.OreGenHandler.setupOregenFile(OreGenHandler.java:26)
    at com.shinoow.beneath.Beneath.init(Beneath.java:149)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:637)


Affected versions ("latest" is NOT a version):

  • Minecraft: 1.12.2
  • Forge: 14.23.5.2854
  • The Beneath: 1.7.0 (The Beneath-1.12.2-1.7.0.jar) w/ Signature 220f10d3a93b3ff5fbaa7434cc629d863d6751b9

Latest log file for when the issue was present:

https://gist.github.com/danielkorczak/cde829e27a208f519e176433335a9f88