Skip to content

imageio-ext-turbojpeg depends on an obsolete version of libjpeg-turbo (v1.2.1)Β #305

@miceg

Description

@miceg

Originally reported in: kartoza/docker-geoserver#653

When using the GeoServer libjpeg-turbo-plugin with libjpeg-turbo v3.0.3 (the current version) to render a layer as JPEG over WMS, it fails with:

16 May 14:36:59 WARN   [geoserver.servlets] - OutputStream could not be aborted in time. An error has occurred and could not be sent to the user.
16 May 14:36:59 ERROR  [geoserver.ows] - 
java.lang.UnsatisfiedLinkError: 'int org.libjpegturbo.turbojpeg.TJCompressor.compress(byte[], int, int, int, int, byte[], int, int, int)'
	at org.libjpegturbo.turbojpeg.TJCompressor.compress(Native Method)
	at org.libjpegturbo.turbojpeg.TJCompressor.compress(TJCompressor.java:146)
	at org.libjpegturbo.turbojpeg.TJCompressor.compress(TJCompressor.java:164)
	at it.geosolutions.imageio.plugins.turbojpeg.TurboJpegImageWriter.write(TurboJpegImageWriter.java:201)
	at org.geoserver.map.turbojpeg.TurboJpegImageWorker.writeTurboJPEG(TurboJpegImageWorker.java:126)

There are similar issues when rendering a raster layer compressed with JPEG.

The root cause of the issue is the it.geosolutions.imageio-ext.imageio-ext-turbojpeg package.

Detail

it.geosolutions.imageio-ext.imageio-ext-turbojpeg (as used in the GeoServer TurboJPEG plugin) currently depends on libjpegturbo "v1.2.1.5" Java wrappers.

Despite the package being org.libjpegturbo.turbojpeg-wrapper v1.2.1.5, it appears that GeoSolutions IT publishes its own fork of the library with the same class names, and it appears to be forked from a pre-1.0 version of libjpeg-turbo from 2013 – not v1.2.1 (released in 2015) EDIT: GitHub's timestamps are wrong, v1.2.1 was actually released in 2012; so this is not a pre-1.0 version.

Upstream libjpeg-turbo still maintains their own libraries, but don't appear to publish them in Maven.

It doesn't look like this repository includes any of the JNI C code (turbojpeg-jni.c), so this fork depends on upstream's libturbojpeg.so.

Around September 2022, upstream removed a bunch of methods from the Java and JNI wrappers, breaking ABI compatibility. These landed in libjpeg-turbo v2.1.90/3.0 beta1 (released in February 2023), and are now in stable v3.0.x releases (from July 2023) – so probably been broken since at least then... but it could have been anything in the last 11 years.

What I think needs to be done here

  • Rename org.libjpegturbo.turbojpeg-wrapper to something like it.geosolutions.turbojpeg-wrapper, so it's very clear that it's GeoSolutions IT's fork of the package, and not upstream.

    While upstream not publishing their own packages is annoying, GeoSolutions stomping their package namespaces isn't the right answer.

  • Update the libjpeg-turbo Java bindings to the current upstream version (currently v3.0.3).

In any case, expecting someone to use an 11+ year old pre-1.0 version of libjpeg-turbo is totally unreasonable. πŸ˜„

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions