DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Tue, 2017-09-26, 01:15

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Mon, 2015-07-20, 16:47 
Offline

Joined: Thu, 2011-02-24, 11:27
Posts: 24
Location: Bremen
Hi,
We are using dcmmkdir (dcmtk 3.6.0) without problems on Windows 7 32 and 64 bit and Windows 8.1 64 bit. On Windows 8.1 32 bit however, it crashes about half of the time.
The crash happens with an arbitrary single DICOM file, and with any option I tried. In debug mode, the crash does not happen (at least not frequently).
printf-Debugging revealed that the crash happens in getMACAddress() in dcuid.cc while generating a new UID, specifically on calling SnmpExtensionQuery() the first time in the loop.
I could not find any problem in the code, but I have never worked with SNMP. I checked the newest sources, but there seem to be no changes in the related functionality.

Do you know about the problem or have any idea how to fix it?

Thanks,
Andreas


Last edited by andreasb on Fri, 2015-07-24, 07:07, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue, 2015-07-21, 08:45 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Mon, 2014-03-03, 09:51
Posts: 210
Location: Oldenburg, Germany
This is a known issue, know in the regard that we already heard about it from other DCMTK users. We currently do not have a Windows 8 testing system, so we could not inspect it any further so far.
We were once told that the Problem was fixed in Windows 8.1 and existed only prior to that version, then, after some month of silence reports from Windows 8.1 users arrived describing the same problem. Maybe some service pack / security update / Visual C++ runtime / etc. fixes the problem is all I can say at this point, and that we have the issue on our ToDo list, also in regard to the upcoming Windows 10 that most likely may also contain this bug / problem.


Top
 Profile  
 
PostPosted: Tue, 2015-07-21, 08:51 
Offline

Joined: Thu, 2011-02-24, 11:27
Posts: 24
Location: Bremen
Thanks - good to know that the problem is under investigation. Do you have any idea of a workaround for the issue, maybe from the other users who have the problem? I guess the problem will happen in all tools generating new UIDs...


Top
 Profile  
 
PostPosted: Tue, 2015-07-21, 09:03 
Offline

Joined: Thu, 2011-02-24, 11:27
Posts: 24
Location: Bremen
Another note - as we do have a testing system (though not a developer system), is there anything we can try to help to understand the issue? Any log files that could help?


Top
 Profile  
 
PostPosted: Wed, 2015-07-22, 12:16 
Offline

Joined: Thu, 2011-02-24, 11:27
Posts: 24
Location: Bremen
Hi again,

I did not understand the real problem, but at least I could fix it.
There is a call to SnmpExtensionQuery() in dcuid.cc that returns the number of available network adaptors. This call seems to be taken from example code (see http://tangentsoft.net/wskfaq/examples/getmac-snmp.html) where it is used to print this number, but is not needed otherwise. If removing it (lines 1315-1318), all seems to work fine.
I guess that there was a call missing to free the used memory or something, but as the code is not needed, I did not evaluate further.
Hope that helps you to fix the problem -
Regards,
Andreas

Here is the change:

Code:
Index: dcuid.cc
===================================================================
--- dcuid.cc   (revision 5199)
+++ dcuid.cc   (revision 5200)
@@ -1312,10 +1312,6 @@
                 varBindList.list = varBind;
                 varBind[0].name = MIB_NULL;
                 varBind[1].name = MIB_NULL;
-                /* copy in the OID to find the number of entries in the inteface table */
-                varBindList.len = 1;        /* only retrieving one item */
-                m_Copy(&varBind[0].name, &MIB_ifEntryNum);
-                ret = m_Query(SNMP_PDU_GETNEXT, &varBindList, &errorStatus, &errorIndex);
                 varBindList.len = 2;
                 /* copy in the OID of ifType, the type of interface */
                 m_Copy(&varBind[0].name, &MIB_ifEntryType);


Top
 Profile  
 
PostPosted: Fri, 2016-01-29, 20:44 
Offline

Joined: Mon, 2009-08-17, 21:40
Posts: 10
Location: California
Wow! Thank you thank you thank you!! We skipped Windows 8, but are seeing crashes on about 50% of our Windows 10 installations, and this seems to fix it!!


Top
 Profile  
 
PostPosted: Mon, 2016-02-01, 08:07 
Offline

Joined: Thu, 2011-02-24, 11:27
Posts: 24
Location: Bremen
You are welcome :)
Maybe it makes sense to incorporate this trivial fix into the trunk now, with Windows 10 out in the wild? Michael, Jörg, anyone?


Top
 Profile  
 
PostPosted: Mon, 2016-02-01, 11:04 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1847
Location: Oldenburg, Germany
Thanks again for the report and suggested fix. I personally have no Windows 8 (or 10) system available since none of my customers ever asked for that, but I can confirm that the code lines deleted by the proposed patch are not needed. So, I removed them and tested the patched version on Windows 7 (Professional, 64-bit).

I also committed the changes to the "testing" branch of our git repository, and if every compiles during the night (and all tests succeed), the changes should be visible in DCMTK's public git repository pretty soon (commit 64bbef6).

Code:
commit 64bbef6831804382a029d0d4e8a30e0f991ab2bf
Author: Joerg Riesmeier <obfuscated-email-address>
Date:   Mon Feb 1 10:51:48 2016 +0100

    Fixed issue with getMACAddress() on Windows 8++.
   
    Fixed issue with getMACAddress() on some Windows 8 (and newer) systems.
    Removed unneeded call to SnmpExtensionQuery() that caused a crash on such
    systems.
   
    Thanks to forum user "andreasb" for the report and suggested fix, and to
    forum user "Rich in Soquel" for confirming that this fix also solves an
    issue on Windows 10.
   
    Closes DCMTK Bug #594 (hopefully)

diff --git a/dcmdata/libsrc/dcuid.cc b/dcmdata/libsrc/dcuid.cc
index 3fd3a3d..fbc558d 100644
--- a/dcmdata/libsrc/dcuid.cc
+++ b/dcmdata/libsrc/dcuid.cc
@@ -1466,7 +1466,6 @@ static unsigned char *getMACAddress(unsigned char buffer[6])
                 UINT OID_ipMACEntAddr[] = {1, 3, 6, 1, 2, 1, 2, 2, 1, 6};
                 AsnObjectIdentifier MIB_ifMACEntAddr = {sizeof(OID_ipMACEntAddr) / sizeof(UINT), OID_ipMACEntAddr};
                 AsnObjectIdentifier MIB_ifEntryType = {sizeof(OID_ifEntryType) / sizeof(UINT), OID_ifEntryType};
-                AsnObjectIdentifier MIB_ifEntryNum = {sizeof(OID_ifEntryNum) / sizeof(UINT), OID_ifEntryNum};
                 SnmpVarBindList varBindList;
                 SnmpVarBind varBind[2];
                 AsnInteger32 errorStatus;
@@ -1484,10 +1483,6 @@ static unsigned char *getMACAddress(unsigned char buffer[6])
                 varBindList.list = varBind;
                 varBind[0].name = MIB_NULL;
                 varBind[1].name = MIB_NULL;
-                /* copy in the OID to find the number of entries in the interface table */
-                varBindList.len = 1;        /* only retrieving one item */
-                m_Copy(&varBind[0].name, &MIB_ifEntryNum);
-                ret = m_Query(SNMP_PDU_GETNEXT, &varBindList, &errorStatus, &errorIndex);
                 varBindList.len = 2;
                 /* copy in the OID of ifType, the type of interface */
                 m_Copy(&varBind[0].name, &MIB_ifEntryType);


Top
 Profile  
 
PostPosted: Mon, 2016-02-01, 12:58 
Offline

Joined: Thu, 2011-02-24, 11:27
Posts: 24
Location: Bremen
Thanks Jörg - that was fast!
- Andreas


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

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


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group