dcmmkdir crash under Windows 8 32 bit (SOLVED)
Moderator: Moderator Team
dcmmkdir crash under Windows 8 32 bit (SOLVED)
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
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.
-
- OFFIS DICOM Team
- Posts: 318
- Joined: Mon, 2014-03-03, 09:51
- Location: Oldenburg, Germany
Re: dcmmkdir crash under Windows 8 32 bit
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.
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.
Re: dcmmkdir crash under Windows 8 32 bit
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...
Re: dcmmkdir crash under Windows 8 32 bit
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?
Re: dcmmkdir crash under Windows 8 32 bit (SOLVED)
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:
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: Select all
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);
-
- Posts: 15
- Joined: Mon, 2009-08-17, 21:40
- Location: California
Re: dcmmkdir crash under Windows 8 32 bit (SOLVED)
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!!
Re: dcmmkdir crash under Windows 8 32 bit (SOLVED)
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?
Maybe it makes sense to incorporate this trivial fix into the trunk now, with Windows 10 out in the wild? Michael, Jörg, anyone?
-
- DCMTK Developer
- Posts: 2548
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: dcmmkdir crash under Windows 8 32 bit (SOLVED)
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).
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: Select all
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);
Re: dcmmkdir crash under Windows 8 32 bit (SOLVED)
Thanks Jörg - that was fast!
- Andreas
- Andreas
Who is online
Users browsing this forum: Bing [Bot] and 1 guest