micdoodle8 / Galacticraft

An advanced Space Dimension Mod for Minecraft
Other
610 stars 329 forks source link

JPEG library broken #1321

Closed Baughn closed 9 years ago

Baughn commented 9 years ago

It's not your fault, but I'm seeing crashes when initializing GalactiCraftCore::jpgWriter due to broken OpenJDK builds:

cpw.mods.fml.common.LoaderException: java.lang.UnsatisfiedLinkError: com.sun.imageio.plugins.jpeg.JPEGImageWriter.initWriterIDs(Ljava/lang/Class;Ljava/lang/Class;)V at cpw.mods.fml.common.LoadController.transition(LoadController.java:162) at cpw.mods.fml.common.Loader.serverStarted(Loader.java:753) at cpw.mods.fml.common.FMLCommonHandler.handleServerStarted(FMLCommonHandler.java:283) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:389) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) Caused by: java.lang.UnsatisfiedLinkError: com.sun.imageio.plugins.jpeg.JPEGImageWriter.initWriterIDs(Ljava/lang/Class;Ljava/lang/Class;)V at com.sun.imageio.plugins.jpeg.JPEGImageWriter.initWriterIDs(Native Method) at com.sun.imageio.plugins.jpeg.JPEGImageWriter.(JPEGImageWriter.java:186) at com.sun.imageio.plugins.jpeg.JPEGImageWriterSpi.createWriterInstance(JPEGImageWriterSpi.java:96) at javax.imageio.spi.ImageWriterSpi.createWriterInstance(ImageWriterSpi.java:351) at javax.imageio.ImageIO$ImageWriterIterator.next(ImageIO.java:843) at javax.imageio.ImageIO$ImageWriterIterator.next(ImageIO.java:827) at micdoodle8.mods.galacticraft.core.GalacticraftCore.serverInit(GalacticraftCore.java:324)

Can you use PNG instead? Alternately, can you make that a config option?

radfast commented 9 years ago

Please explain more how this error can arise, like why do you have a different JPG library from other Minecraft players?

Baughn commented 9 years ago

The JPEG library is part of the JRE. OpenJDK currently ships a broken version.

See http://trac.openmicroscopy.org.uk/ome/ticket/12612

radfast commented 9 years ago

While obviously we believe in open source software, I'm not minded to change Galacticraft to use a PNG instead, as apart from the time involved, that would require us to include an extra library in the binary as the JRE has no PNG library, and there might then be licensing issues etc as Galacticraft's licence is not unrestricted, it's free for non-commercial use.

I don't see any reason why you can't run Galacticraft in the JRE (until that JPEG library issue is fixed) in which case this problem is solved.

Baughn commented 9 years ago

You misunderstand. The JRE I've got is OpenJDK, and it's missing a functional JPEG library. It's not an actual JDK, it's just called that... well, there is a JDK version as well, but that's besides the point.

It's also the default JRE for most debian-derived linux distributions.

Baughn commented 9 years ago

You could get around this using a pure-Java JPEG library. https://code.google.com/p/jj2000/, for example.

(That's JPEG2000, but that should be fine. Slightly better compression.)

radfast commented 9 years ago

OK thanks we can take a look at that library, as it seems this is potentially an issue for any Linux-based server running Galacticraft

halvors commented 9 years ago

When will this be done?

EzerArch commented 9 years ago

When will this be done?

We usually don't set ETAs.

radfast commented 9 years ago

I've discussed this with micdoodle8 and we don't have a good solution right now:

We will keep an eye on the situation, if it becomes clear that a category of servers has no good solution for this and it's affecting a large number of servers then we will think again.

Baughn commented 9 years ago

It's easy to fix server-side, as you say; use a non-broken version of Java.

It's more of a concern for me client-side, since not all players are equally capable at running their systems. They may have a broken OpenJDK install; they will blame me, Galacticraft or both, but will at any rate not be able to fix their system without serious hand-holding.

I don't have a good solution either, if distributing the library is out. Maybe some code change such that GC at least doesn't crash? But how playable is it without the JPEGs?

radfast commented 9 years ago

OK we can probably catch the crash and play without the JPEGs. If the server does not send the JPEG to the client then the client will use the default Overworld image, so Display screens and rocket takeoff will look a bit sucky, that's all.

I'll look at this next time I update that code, which will be soon - there are other open issues with it as well.

Baughn commented 9 years ago

How large are these images, really? How often are they sent? Could they be cached?

I ask because another option would be to send them uncompressed, as bitmaps. It's not my preference... but it's an option.

radfast commented 9 years ago

Again that's asking for substantial code changes in the mod, including the networking code - so servers/clients would not be compatible before and after the change - to fix a problem which is really not our problem in the first place. Given that OpenJDK is open source, it would probably take less time for me just to go fix the bug in its JPEG library (but I assume other people are already working on that?)

For now, I am happy to include code in Galacticraft to trap the error so there is no crash, that's totally reasonable.