Page MenuHomePhabricator

MitkDICOMQIIO.dll causes crashes for VerifyDICOMMitkImageDump.exe
Closed, ResolvedPublic

Description

This was discovered by some Dashboard tests very uninformatively failing.

If I remove the dll from the MitkCore autoload folder the exe works fine, if I add it back again I get the following errors:

\bin\MITK-build\bin\Release>VerifyDICOMMitkImageDump.exe
Wed Nov 22 17:37:17 2017
0.05 core.mod.core.act WARNING: In us::GetModuleContext at \MITK\Modules\CppMicroServices\core\include\usGetModuleContext.h:57 : Module 'MitkDICOMReader' unknown. The calling module probably misses a US_MODULE_NAME compile definition and/or a call to US_INITIALIZE_MODULE in one of its source files.
0.48 core.mod.core.act WARNING: In `anonymous-namespace'::load_impl at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:90 : Eine DLL-Initialisierungsroutine ist fehlgeschlagen.
0.49 core.mod.core.act WARNING: In us::AutoLoadModulesFromPath at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:176 : Auto-loading of module \bin\MITK-build\bin\MitkCore\Release\MitkDICOMQIIO.dll failed.
0.95 core.mod.core.act WARNING: In `anonymous-namespace'::load_impl at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:90 : Eine DLL-Initialisierungsroutine ist fehlgeschlagen.
0.96 core.mod.core.act WARNING: In us::AutoLoadModulesFromPath at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:176 : Auto-loading of module \bin\MITK-build\bin\MitkCore\Release\MitkDicomRTIO.dll failed.
1.01 core.mod.matchPntReg.mapregistrationwrapperObjFac: MAPRegistrationWrapperObjectFactory c'tor
1.01 core.mod.matchPntReg.regevaluationObjFac: RegEvaluationObjectFactory c'tor
1.41 core.mod.core.act WARNING: In `anonymous-namespace'::load_impl at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:90 : Eine DLL-Initialisierungsroutine ist fehlgeschlagen.
1.42 core.mod.core.act WARNING: In us::AutoLoadModulesFromPath at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:176 : Auto-loading of module \bin\MITK-build\bin\MitkCore\Release\MitkDiffusionCoreIO.dll failed.
1.48 core.mod.matchPntReg.mapregistrationwrapperObjFac: MAPRegistrationWrapperObjectFactory c'tor
1.48 core.mod.matchPntReg.regevaluationObjFac: RegEvaluationObjectFactory c'tor
1.94 core.mod.core.act WARNING: In `anonymous-namespace'::load_impl at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:90 : Eine DLL-Initialisierungsroutine ist fehlgeschlagen.
1.96 core.mod.core.act WARNING: In us::AutoLoadModulesFromPath at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:176 : Auto-loading of module \bin\MITK-build\bin\MitkCore\Release\MitkDiffusionIO.dll failed.
2.31 core.mod.core.act WARNING: In `anonymous-namespace'::load_impl at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:90 : Eine DLL-Initialisierungsroutine ist fehlgeschlagen.
2.32 core.mod.core.act WARNING: In us::AutoLoadModulesFromPath at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:176 : Auto-loading of module \bin\MITK-build\bin\MitkCore\Release\MitkIGTIO.dll failed.
2.71 core.mod.core.act WARNING: In `anonymous-namespace'::load_impl at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:90 : Eine DLL-Initialisierungsroutine ist fehlgeschlagen.
2.73 core.mod.core.act WARNING: In us::AutoLoadModulesFromPath at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:176 : Auto-loading of module \bin\MITK-build\bin\MitkCore\Release\MitkIOExt.dll failed.
3.07 core.mod.core.act WARNING: In `anonymous-namespace'::load_impl at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:90 : Eine DLL-Initialisierungsroutine ist fehlgeschlagen.
3.08 core.mod.core.act WARNING: In us::AutoLoadModulesFromPath at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:176 : Auto-loading of module \bin\MITK-build\bin\MitkCore\Release\MitkIpPicSupportIO.dll failed.
3.10 core.mod.matchPntReg.mapregistrationwrapperObjFac: MAPRegistrationWrapperObjectFactory c'tor
3.11 core.mod.matchPntReg.regevaluationObjFac: RegEvaluationObjectFactory c'tor
3.48 core.mod.core.act WARNING: In `anonymous-namespace'::load_impl at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:90 : Eine DLL-Initialisierungsroutine ist fehlgeschlagen.
3.49 core.mod.core.act WARNING: In us::AutoLoadModulesFromPath at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:176 : Auto-loading of module \bin\MITK-build\bin\MitkCore\Release\MitkMatchPointRegistrationIO.dll failed.
3.92 core.mod.core.act WARNING: In `anonymous-namespace'::load_impl at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:90 : Eine DLL-Initialisierungsroutine ist fehlgeschlagen.
3.94 core.mod.core.act WARNING: In us::AutoLoadModulesFromPath at \MITK\Modules\CppMicroServices\core\src\util\usUtils.cpp:176 : Auto-loading of module \bin\MITK-build\bin\MitkCore\Release\MitkMultilabelIO.dll failed.
3.95 core.mod.dicomTesting.verifydicommitkimagedump ERROR: Usage:
3.96 core.mod.dicomTesting.verifydicommitkimagedump ERROR:   VerifyDICOMMitkImageDump.exe reference.dump file1 [file2 .. fileN]
3.96 core.mod.dicomTesting.verifydicommitkimagedump ERROR:
3.97 core.mod.dicomTesting.verifydicommitkimagedump ERROR:   Loads all DICOM images in file1 to fileN as MITK images
3.98 core.mod.dicomTesting.verifydicommitkimagedump ERROR:   and compares loaded images against stored expectations (dumps).
3.98 core.mod.dicomTesting.verifydicommitkimagedump ERROR:   See also DumpDICOMMitkImage (generates dumps)

The code itself seems very similar to e.g. MitCESTIO, which works fine.

Event Timeline

Call stack is

MitkDICOMReader.dll!us::GetModuleContext() Line 57	
MitkDICOMReader.dll!mitk::GetDicomTagsOfInterestService() Line 32	
MitkDICOMQIIO.dll!mitk::DICOMSegmentationIO::AddDICOMTagsToService() Line 59	
MitkDICOMQIIO.dll!mitk::DICOMSegmentationIO::DICOMSegmentationIO() Line 54	
MitkDICOMQIIO.dll!mitk::DICOMQIIOModulActivator::Load(us::ModuleContext * context) Line 50	
CppMicroServices.dll!us::Module::Start() Line 160	
CppMicroServices.dll!us::ModuleRegistry::Register(us::ModuleInfo * info) Line 129

I assume the problem here is, that during the DICOMQIIOModulActivator Load it tries to add tags to the DICOM tag service, which is not available at the time. I will take a look at potentially deferring the adding of DICOM tags.

Moving the this->AddDICOMTagsToService(); line from the constructor somewhere else removes the crash.

kislinsk triaged this task as Normal priority.Nov 28 2017, 10:45 PM

Solved for now by checking whether the context is valid in mitkDICOMIOHelper.cpp, gives a warning instead of crashing if the context does not exist. This should solve the dashboard crashes, but will not guarantee all DICOMQI tags of interest are registered correctly. However they should work as well as before.

I also moved the DICOMQI module to a MultiLabel IO module as it only contained IO and required the MultiLabel anyway and part of the DICOMQI implementation was in the MultiLabel module anyway, which was rather unexpected given the separate module.