Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JVM crash caused by libclib_jiio.so #1256

Open
ichijikuibo opened this issue Oct 24, 2022 · 1 comment
Open

JVM crash caused by libclib_jiio.so #1256

ichijikuibo opened this issue Oct 24, 2022 · 1 comment

Comments

@ichijikuibo
Copy link

Describe the bug
I am using dcm4che on a java web application to convert Dicom Files to jpg which is mostly working fine but occasionally I get a JVM crash caused by libclib_jiio.so from the linux-x86-64 lib folder in dcm4che.

A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0x00007f8e3dc032d1, pid=17209, tid=13711
JRE version: OpenJDK Runtime Environment Corretto-11.0.16.9.1 (11.0.16.1+9) (build 11.0.16.1+9-LTS)
Java VM: OpenJDK 64-Bit Server VM Corretto-11.0.16.9.1 (11.0.16.1+9-LTS, mixed mode, tiered, compressed oops, parallel gc, linux-amd64)
Problematic frame:
C  [libclib_jiio.so+0x742d1]  jpeg_read_markers+0x461

After much investigation I discovered that the problem wasn’t actually happening when converting Dicoms but when reading jpegs with Javax imageio. I was able to fix this problem by including OpenCV 4.5.5(doesn’t depend on libclib_jiio.so) in a separate folder but doing this prevents dcm4che from opening image DCM images with jpeg compression because the included OpenCV is missing methods. I also tried building OpenCV myself to include Dicom support but it didn’t change anything.

java.lang.UnsatisfiedLinkError: 'long org.opencv.imgcodecs.Imgcodecs.dicomJpgFileRead_0(java.lang.String, long, long, int, int)'

I can’t seem to find any reference to this method in OpenCV’s documentation, is this a custom method added to OpenCV for dcm4che or is there some way to build OpenCV that includes this method?

I’m not certain if this is a bug in dcm4che or if there is something wrong with how I am using it but I thought it would be good to log it here in case it is something that needs looked at or if anyone has a workaround.

To Reproduce
Difficult to reproduce but I have a specific set of images that when uploaded together cause the crash, I believe 1 or multiple become corrupted in transit but haven’t been able to confirm this or find 1 specific image that always causes the crash.

Expected behavior
I expect reading jpgs with ImageIO and Dicoms with dcm4che to either work or fail without crashing the JVM.

  • OS: Any desktop OS server is on Amazon Linux 2 and replicated locally using Ubuntu 22.04
  • Browser any
  • Version any
@nroduit
Copy link
Member

nroduit commented Dec 30, 2022

It would help if you describe how your read image.

java.lang.UnsatisfiedLinkError: 'long org.opencv.imgcodecs.Imgcodecs.dicomJpgFileRead_0(java.lang.String, long, long, int, int)'

This means that the API is different from that of the native library. The cause is certainly that the version of the native library does not correspond to the version of dcm4chee.

It is necessary to load the library which is in dcm4che-5.29.2/lib/linux-x86-64/libopencv_java.so with the Java Option: -Djava.library.path=/NATIVE_SHARED_LIB_FOLDER

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants