openjpeg icon indicating copy to clipboard operation
openjpeg copied to clipboard

infinite loop ( Not enough space for expected EPH/SOP marker) in test 1330 with 2.5.3 on OpenBSD

Open landryb opened this issue 1 year ago • 5 comments

Expected behavior and actual behavior.

running all tests on 2.5.3 release, it should be fine, but it goes into an infinite loop on test 1330:

1330: [WARNING] Not enough space for expected EPH marker
1330: [WARNING] Not enough space for expected SOP marker
1330: [WARNING] Not enough space for expected EPH marker
1330: [WARNING] Not enough space for expected SOP marker

(i have a 1.2Gb logfile before i stopped it..)

will provide more details/dig deeper shortly if i can reproduce at will

Steps to reproduce the problem.

running tests on OpenBSD

Operating system

OpenBSD

openjpeg version

2.5.3

landryb avatar Dec 11 '24 16:12 landryb

CC @mayeut as it is likely related to c58bc128b4f770e7c89bc8ba3d0273b9a3904aad

rouault avatar Dec 11 '24 16:12 rouault

This looks like the behavior before https://github.com/uclouvain/openjpeg/commit/c58bc128b4f770e7c89bc8ba3d0273b9a3904aad

All instances of message Not enough space for expected EPH marker have been patched to return an error in that commit:

openjpeg % grep -r -B1 -A1 'Not enough space for required EPH marker'
./src/lib/openjp2/t2.c-                opj_event_msg(p_manager, EVT_ERROR,
./src/lib/openjp2/t2.c:                              "Not enough space for required EPH marker\n");
./src/lib/openjp2/t2.c-                return OPJ_FALSE;
--
./src/lib/openjp2/t2.c-            opj_event_msg(p_manager, EVT_ERROR,
./src/lib/openjp2/t2.c:                          "Not enough space for required EPH marker\n");
./src/lib/openjp2/t2.c-            return OPJ_FALSE;

The description shows the message being reported as a warning instead of an error. It seems that the new test is ran against an old library and/or opj_decompress binary for some reason.

mayeut avatar Dec 11 '24 20:12 mayeut

the beginning of the looping test is this in the log:

test 1330
          Start 1330: NR-DEC-issue1472-bigloop.j2k-320-decode

1330: Test command: /usr/obj/ports/openjp2-2.5.3/build-amd64/bin/opj_decompress "-i" "/usr/obj/ports/openjp2-2.5.3/data/input/nonregression/issue1472-bigloop.j2k" "-o" "/usr/obj/ports/openjp2-2.5.3/build-amd64/tests/nonregression/Temporary/issue1472-bigloop.raw"
1330: Working Directory: /usr/obj/ports/openjp2-2.5.3/build-amd64/tests/nonregression
1330: Test timeout computed to be: 1500
1330: 
1330: [INFO] Start to read j2k main header (0).
1330: [INFO] Main header has been correctly decoded.
1330: [INFO] No decoded area parameters, set the decoded area to the whole image
1330: [INFO] Header of tile 1 / 1041 has been read.
1330: [WARNING] Not enough space for expected SOP marker
1330: [WARNING] Not enough space for expected EPH marker

The description shows the message being reported as a warning instead of an error. It seems that the new test is ran against an old library and/or opj_decompress binary for some reason.

that might be possible, since 2.5.2 is installed systemwide. In that case, that would be a build system problem, because i would expect the binaries to be linked with the library in the build/objdir and not picking up a random version of the library ?

landryb avatar Dec 12 '24 08:12 landryb

looking at the opj_decompress binary, it doesn't have a RUNPATH pointing at the objdir:

$objdump -p /usr/obj/ports/openjp2-2.5.3/build-amd64/bin/opj_decompress|grep openjp
/usr/obj/ports/openjp2-2.5.3/build-amd64/bin/opj_decompress:     file format elf64-x86-64
  RUNPATH     /usr/obj/ports/openjp2-2.5.3/build-amd64/bin:/usr/local/lib:
  NEEDED      libopenjp2.so.6.0

so i guess you're right that it takes the installed 2.5.2 library.

installing 2.5.3 systemwide on top of 2.5.2 allows all tests except 2 to pass

99% tests passed, 2 tests failed out of 1334

Total Test time (real) = 671.90 sec

The following tests FAILED:
        894 - NR-DEC-issue226.j2k-74-decode (Failed)
        895 - NR-DEC-issue226.j2k-74-decode-md5 (Failed)

details below:

894: ERROR -> opj_decompress: failed to decode image!
894: [INFO] Start to read j2k main header (0).
894: [INFO] Main header has been correctly decoded.
894: [INFO] No decoded area parameters, set the decoded area to the whole image
894: [INFO] Header of tile 1 / 1 has been read.
894: [ERROR] Stream too short, expected SOT
894: [ERROR] Failed to decode tile 1/1
895: CMake Error at /usr/obj/ports/openjp2-2.5.3/openjpeg-2.5.3/tests/nonregression/checkmd5refs.cmake:37 (message):
895:   Could not find output PGX files: issue226.j2k

as for the original issue at hand, should opj_decompress have a RUNPATH pointing at the objdir (or LD_LIBRARY_PATH set in the test env ?), or should i ensure the new version of the lib is installed to run tests ? for the second option, i can do something in the openbsd ports tree infra, for the first it has to be fixed upstream...

landryb avatar Dec 12 '24 08:12 landryb

installing 2.5.3 systemwide on top of 2.5.2 allows all tests except 2 to pass

yes that failure is expected / not to worry about. It is in the allow list of our CI

should opj_decompress have a RUNPATH pointing at the objdir

I beleive CMake is assumed to set it for non-installed binaries (but not on installed ones), at least on "common" platforms

rouault avatar Dec 12 '24 11:12 rouault