ruven / iipsrv

iipsrv is an advanced high-performance feature-rich image server for web-based streamed viewing and zooming of ultra high-resolution images.
https://iipimage.sourceforge.io
GNU General Public License v3.0
292 stars 115 forks source link

IIP crashes when processing larger JPEG2000 images with CVT JPEG with HEI < 129px #235

Closed filak closed 2 years ago

filak commented 2 years ago

It seems to me that this is very similar to https://github.com/ruven/iipsrv/issues/189

<----------------------------------->
Mon Aug 22 12:40:41 2022

IIPImage Server. Version 1.1
*** ... ***

Verbosity level set to 10
Running in FCGI mode

Setting maximum image cache size to 500MB
Setting filesystem prefix to 'k:/repo/iip-data'
Setting filesystem suffix to ''
Setting default JPEG quality to 90
Setting maximum CVT size to 3500
Setting HTTP Cache-Control header to 'max-age=86400'
Setting 3D file sequence name pattern to '_pyr_'
Setting default IIIF Image API version to 2
Setting max quality layers (for supported file formats) to all layers
Setting Allow Upscaling to false
Setting ICC profile embedding to false
Setting up JPEG2000 support via OpenJPEG
Setting image processing engine to CPU processor
Memcached support enabled. Connected to servers: '127.0.0.1:....' with timeout 86400

Initialisation Complete.
<----------------------------------->

Full Request is FIF=/...a9f977f.jp2&HEI=128&CVT=jpeg
[1/3]: Command / Argument is FIF : /...a9f977f.jp2
FIF handler reached
FIF :: URL decoding/filtering: /...a9f977f.jp2 => /...a9f977f.jp2
FIF :: Image cache initialization
FIF :: JPEG2000 image detected
FIF :: Opening image 
FIF :: Opening image - DONE 
FIF :: Checking timestamp 
FIF :: Checking timestamp - DONE 
FIF :: Adding image to cache 
FIF :: Adding image to cache - DONE 
FIF :: Created image
FIF :: Setting timestamp 
FIF :: Setting timestamp - DONE 
FIF :: Image dimensions are 5948 x 8232
FIF :: Image contains 3 channels with 8 bits per channel
FIF :: Image timestamp: Wed, 22 Jun 2022 12:36:40 GMT
FIF :: Checking if_modified_since 
FIF :: Checking if_modified_since - DONE 
FIF :: Total command time 0 microseconds
[2/3]: Command / Argument is HEI : 128
HEI handler reached
HEI :: requested height is 128
[3/3]: Command / Argument is CVT : jpeg
CVT :: JPEG output
CVT handler reached
CVT :: Using resolution 0 with size 92x128
CVT :: No view port set
CVT :: Requested scaled region size is 92x128. Nearest existing resolution is 0 which has region with size 92x128
TileManager getRegion :: requesting region directly from image
<----------------------------------->
Mon Aug 22 12:40:44 2022

IIPImage Server. Version 1.1
*** ...
filak commented 2 years ago

The problem shows both with IIP and IIIF protocols:

/fcgi-bin/iipsrv.fcgi?FIF=/e.jp2&HEI=100&CVT=jpeg

/fcgi-bin/iipsrv.fcgi?IIIF=/e.jp2/full/100,/0/default.jpg

However this pull request https://github.com/ruven/iipsrv/pull/233 fixes the IIIF call.

filak commented 2 years ago

Hi @ruven, any updates on this ?

ruven commented 2 years ago

I've now merged the pull request (https://github.com/ruven/iipsrv/commit/ea84c761f723581ce8906f35b202b19cec373914). Can you please test and let me know if it everything now works correctly?

filak commented 2 years ago

Thank you, it works as expected.

filak commented 2 years ago

I need to reopen this, the issue still persists. @ruven would you mind if I send you the affected image ?

ruven commented 2 years ago

I need to reopen this, the issue still persists. @ruven would you mind if I send you the affected image ?

Sure, go ahead.

filak commented 2 years ago

OK, done, send to Your sourceforge.net email.

ruven commented 2 years ago

It turns out to have been due to a bug in iipsrv's OpenJPEG decoder. I've just committed a fix (https://github.com/ruven/iipsrv/commit/ffe319016e6b7de57778083a033b7b320e3a9247). Please test and let me know if there's still a problem

filak commented 2 years ago

@ruven I still encounter bigger images which do not play nice with IIP protocol:

/fcgi-bin/iipsrv.fcgi?FIF=/xx.jp2&HEI=128&CVT=jpeg

(IIIF works fine in these cases: IIIF=/xx.jp2/full/128,/0/default.jpg)

I will try to send the image to your sourceforge.net email.

ahankinson commented 2 years ago

128, in IIIF is w,h -- you can try with IIIF=/xx.jp2/full/,128/0/default.jpg and see if that triggers it?

filak commented 2 years ago

Sorry, poor testing on my part...

This works: /full/,131/0/default.jpg

But bellow 131 it does not: /full/,130/0/default.jpg

ruven commented 2 years ago

Your xx.jp2 image works fine with the above requests on my machine. Are you sure you are using the latest iipsrv which includes the https://github.com/ruven/iipsrv/commit/ffe319016e6b7de57778083a033b7b320e3a9247 commit? Make sure you're using the latest code and maybe do a make clean before rebuilding.

If it still crashes, give me the last 10 lines from the iipsrv log file.

filak commented 2 years ago

Hmmm, maybe I did not update my fork before building... With the most recent version and after rebuilding everything works fine. Thank you!