cantaloupe-project / cantaloupe

High-performance dynamic image server in Java
https://cantaloupe-project.github.io/
Other
269 stars 111 forks source link

EOFException with KakaduProcessor #648

Open jcoyne opened 8 months ago

jcoyne commented 8 months ago
curl http://imageserver-prod.stanford.edu/iiif/2/kn%2F736%2Fgk%2F9639%2Fkn736gk9639_0001.jp2/info.json
500 Internal Server Error

java.io.EOFException
    at java.desktop/javax.imageio.stream.ImageInputStreamImpl.readFully(ImageInputStreamImpl.java:353)
    at java.desktop/javax.imageio.stream.ImageInputStreamImpl.readFully(ImageInputStreamImpl.java:361)
    at edu.illinois.library.cantaloupe.image.iptc.Reader.readNextDataSet(Reader.java:100)
    at edu.illinois.library.cantaloupe.image.iptc.Reader.readNextDataSet(Reader.java:103)
    at edu.illinois.library.cantaloupe.image.iptc.Reader.readNextDataSet(Reader.java:103)
    at edu.illinois.library.cantaloupe.image.iptc.Reader.read(Reader.java:67)
    at edu.illinois.library.cantaloupe.processor.KakaduNativeProcessor.readMetadata(KakaduNativeProcessor.java:303)
    at edu.illinois.library.cantaloupe.processor.KakaduNativeProcessor.readInfo(KakaduNativeProcessor.java:282)
    at edu.illinois.library.cantaloupe.cache.InfoService.readInfo(InfoService.java:220)
    at edu.illinois.library.cantaloupe.cache.InfoService.getOrReadInfo(InfoService.java:153)
    at edu.illinois.library.cantaloupe.cache.CacheFacade.getOrReadInfo(CacheFacade.java:67)
    at edu.illinois.library.cantaloupe.resource.AbstractRequestHandler.getOrReadInfo(AbstractRequestHandler.java:39)
    at edu.illinois.library.cantaloupe.resource.InformationRequestHandler.handle(InformationRequestHandler.java:291)
    at edu.illinois.library.cantaloupe.resource.iiif.v2.InformationResource.doGET(InformationResource.java:82)
    at edu.illinois.library.cantaloupe.resource.HandlerServlet.handle(HandlerServlet.java:97)
    at edu.illinois.library.cantaloupe.resource.HandlerServlet.doGet(HandlerServlet.java:35)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:645)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:554)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
    at org.eclipse.jetty.server.Server.handle(Server.java:516)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
    at java.base/java.lang.Thread.run(Thread.java:829)

In the heap dump, I see this:

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f25ac2b352a, pid=72142, tid=551604
#
# JRE version: OpenJDK Runtime Environment (11.0.22+7) (build 11.0.22+7-post-Ubuntu-0ubuntu220.04.1)
# Java VM: OpenJDK 64-Bit Server VM (11.0.22+7-post-Ubuntu-0ubuntu220.04.1, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  [libkdu_jni.so+0x20252a]  kdu_supp::kdu_region_decompressor::process(int*, kdu_core::kdu_coords, int, int, int, kdu_core::kdu_dims&, kdu_core::kdu_dims&)+0xda
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

I am able to run kdu_jp2info on the file with no trouble, but that is from Kakadu version 8.4.1, which is a bit newer than the version that ships with Cantaloupe.

./kdu_jp2info -i /stacks/kn/736/gk/9639/kn736gk9639_0001.jp2

<JP2_family_file>
  <ftyp name="file-type box" header="8" body="12" pos="12">
    <brand> "jp2_" 0x6A703220 </brand>
    <minor_version> 0 </minor_version>
    <compatible_brand> "jp2_" 0x6A703220 </compatible_brand>
  </ftyp>
  <jp2h name="JP2-header box" header="8" body="63" pos="32">
    <ihdr name="image-header box" header="8" body="14" pos="40"></ihdr>
    <colr name="colour box" header="8" body="7" pos="62"></colr>
    <res_ name="resolution box" header="8" body="18" pos="77">
      <resc name="capture-resolution box" header="8" body="10" pos="85"></resc>
    </res_>
  </jp2h>
  <uuid name="UUID box" header="8" body="5,188" pos="103"></uuid>
  <uuid name="UUID box" header="8" body="56" pos="5,299"></uuid>
  <jp2c name="contiguous-codestream box" header="8" body="rubber" pos="5,363">
    <codestream>
      <width> 11648 </width>
      <height> 8736 </height>
      <components> 3 </components>
      <tiles> 1 </tiles>
    </codestream>
  </jp2c>
</JP2_family_file>
DiegoPino commented 8 months ago

@jcoyne any change the issue is with iptc/IIM attributes? Embedded metadata on that file? We have seen dumps like that with other processors too. Not often, but we have seen them

jcoyne commented 8 months ago

Exiftool does give this warning, but I'm not sure what to make of it.

Warning                         : Unrecognized UUID-IPTC box
DiegoPino commented 8 months ago

Yeah that reads like an issue with the IPTC reader in cantaloupe or maybe a value in that field issue? https://exiftool.org/TagNames/Jpeg2000.html