JVM Crash when DCMTK used in JNI

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Pramod
Posts: 27
Joined: Fri, 2007-09-07, 07:41

JVM Crash when DCMTK used in JNI

#1 Post by Pramod »

Hi,

I would like to know, in Linux machin, is it possible to load two different DICOM files at the same time.
What I am trying to do is, I created a JNI library to read dicom dataset, but when I load more than one files at the same time, its crashing Java Virtual Machine.
Following is the crash log:

Code: Select all

#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  SIGSEGV (0xb) at pc=0x00002aaabc198a99, pid=22877, tid=1124096320
#
# Java VM: Java HotSpot(TM) 64-Bit Server VM (1.5.0_21-b01 mixed mode)
# Problematic frame:
# C  [libdcmreaddataset.so.10+0x198a99]  _ZN21DJDecoderRegistration7cleanupEv+0xa1
#
Could anyone please tell me what could be the problem?

Thanks and Regards
Pramod

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

I would like to know, in Linux machin, is it possible to load two different DICOM files at the same time.
Of course, this is possible. The problem is probably with your implemention. What exactly did you do?

From the error message it seems that there is an issue with the JPEG decoder deregistration (cleanup).

Pramod
Posts: 27
Joined: Fri, 2007-09-07, 07:41

#3 Post by Pramod »

Hi Jörg,
Thanks for the reply.

I am using DCM4CHE's storescp program for tesing my library.
In this library, after reading the dataset, program is changing the compression of the DICOM image, if its compressed.
I identified that the problem is not related to any particular image.
The same image if I tried again, then its working.
And this problem is not happening always.

Please tell me what could be the problem.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#4 Post by Jörg Riesmeier »

The question is probably: When and how often do you call the cleanup() function.

Btw, you are hopefully aware of the following comment inthe API documentation of the cleanup() function: "Attention: Must not be called while other threads might still use the registered codecs, e.g. because they are currently decoding DICOM data sets through dcmdata."

Pramod
Posts: 27
Joined: Fri, 2007-09-07, 07:41

#5 Post by Pramod »

Hi Jörg,

I am doing the codec registration and clean up for each image.
I suspect this could be the problem.
Is there any function in DCMTK, by which we can check whether the codec is already registered or not?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#6 Post by Jörg Riesmeier »

Why don't you just register the codec at application start and clean it up when the application is terminated?
Is there any function in DCMTK, by which we can check whether the codec is already registered or not?
From "dcddirif.cc":

Code: Select all

    /* check whether (possibly required) RLE/JPEG/JP2K decoders are registered */
    RLESupport  = DcmCodecList::canChangeCoding(EXS_RLELossless, EXS_LittleEndianExplicit);
    JPEGSupport = DcmCodecList::canChangeCoding(EXS_JPEGProcess1TransferSyntax, EXS_LittleEndianExplicit) &&
                  DcmCodecList::canChangeCoding(EXS_JPEGProcess14SV1TransferSyntax, EXS_LittleEndianExplicit);
    JP2KSupport = DcmCodecList::canChangeCoding(EXS_JPEG2000LosslessOnly, EXS_LittleEndianExplicit) &&
                  DcmCodecList::canChangeCoding(EXS_JPEG2000, EXS_LittleEndianExplicit);

Pramod
Posts: 27
Joined: Fri, 2007-09-07, 07:41

#7 Post by Pramod »

Hi Jörg,
Thankyou very much for your time.
I will do the change as you sugggested.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest