ComputerCraft icon indicating copy to clipboard operation
ComputerCraft copied to clipboard

Java Exception Thrown: java.lang.NullPointerException

Open OfficialStamper opened this issue 6 years ago • 6 comments

I am getting the following errors, at random times, in random places

Java Exception Thrown: java.lang.NullPointerException Java Exception Thrown: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

against the following statements:

monitor.write() monitor.setTextColor() monitor.setBackgroundColor()

and they coincide with with this message in the server system log:

[20:45:54] [Server thread/WARN] [net.minecraft.tileentity.TileEntity]: Skipping BlockEntity with id

I'm guessing its the monitor peripheral skipping. Is there a workaround/fix?

Minecraft Version: 1.12.2 forge-1.12.2-14.23.4.2715 ComputerCraft1.80pr1.jar

OfficialStamper avatar Aug 22 '18 19:08 OfficialStamper

Can you enable logPeripheralErrors in your config, and then attach your logs next time this occurs? This should include a bit more diagnostic information.

SquidDev avatar Aug 22 '18 20:08 SquidDev

wish I knew about that config setting before, lol

Here is some of the log, it was too large to post it complete. Let me know if you need more.

https://pastebin.com/agrXbmdu

One other point to mention, the same code is running fine on 2 other linux servers and 7 x windows SSP machines, all using slightly different versions of java: 171, 172, and 181. It only happens on this one server!

OfficialStamper avatar Aug 23 '18 07:08 OfficialStamper

Thank you, that's very helpful.

This appears to be an out of bounds within World.getPendingTileEntityAt, which is almost definitely a threading issue. I've rewritten monitors to be thread safe in #507, so that should fix it if it's merged. Can you try running this build from the CI server, or alternatively my fork to see if that helps resolve the issue?

SquidDev avatar Aug 23 '18 17:08 SquidDev

Thanks for looking into this. You mention should fix 'if it's merged'? Or do you mean, when its merged? I will contact the server owner and ask him to test it out, does he just replace his current .jar with your CI Server build one, or is there some 'merge' that has to be done?

OfficialStamper avatar Aug 23 '18 19:08 OfficialStamper

does he just replace his current .jar with your CI Server build one

Yep! I believe it will also require an update to the client as well, so apologies there.

You mention should fix 'if it's merged'? Or do you mean, when its merged? Or is there some 'merge' that has to be done?

Ahh, sorry for the confusion. By "merged", I'm just referring to that code being integrated into the official distribution of the mod, rather than sitting on a separate version.

If you run a version with the fix, the bug shouldn't happen any more - it's just I don't know if it will ever be integrated into the official release, hence the "if".

SquidDev avatar Aug 23 '18 19:08 SquidDev

My server was the troublesome one. I tried the CI build, and I've had 5 different instances running for about 4 hours now, so that seems to have done the trick.

Here's to hoping it makes it into the official mod release :)

DBHaslund avatar Aug 24 '18 07:08 DBHaslund