View Issue Details

IDProjectCategoryView StatusLast Update
0008030Compliance Test Tool (CTT) Unified Architecture2 - CTT Binarypublic2022-08-05 14:28
ReporterJochen Baier Assigned To 
PrioritynormalSeveritycrashReproducibilitysometimes
Status acknowledgedResolutionopen 
Product Version1.04.09.401 
Summary0008030: CTT is crashing during debug run of User Defined Tests
Description

CTT is crashing during debug run (“Start debug run) in 1 of 4 runs. Each run as a duration about an hour. The crash occurs during running User Defined Tests, so I cannot share the scripts easily.
Memory consumption seems not be the problem (less then 1GB peak).

Should I upload the crash dump somewhere? Alternative is creating a new dump with debug symbols if someone send me a binary with symbols.

Additional Information

Crash Info:
0xC0000005, The thread tried to read from or write to a virtual address for which it does not have the appropriate access.

Callstack:

msvcr100.dll!memcpy(unsigned char * dst, unsigned char * src, unsigned long count) Line 254 Unknown
uacompliancetest.exe!00cadc5c() Unknown
uacompliancetest.exe![Frames below may be incorrect and/or missing, no symbols loaded for uacompliancetest.exe] Unknown
uacompliancetest.exe!00cb8b96() Unknown
uacompliancetest.exe!00cb8c24() Unknown
uacompliancetest.exe!00cba9ae() Unknown
uacompliancetest.exe!00cbc08f() Unknown
uacompliancetest.exe!00cb9c93() Unknown
uacompliancetest.exe!00c722ea() Unknown
uacompliancetest.exe!00cb9dcd() Unknown
uacompliancetest.exe!00cbb875() Unknown
uacompliancetest.exe!00c7264e() Unknown
uacompliancetest.exe!00cb9dcd() Unknown
uacompliancetest.exe!00cbba1a() Unknown
uacompliancetest.exe!00cab382() Unknown
uacompliancetest.exe!00ca8ef2() Unknown
QtScript4.dll!6dfdeede()    Unknown
QtScript4.dll!6dfdeede()    Unknown
uacompliancetest.exe!00d37fcc() Unknown
QtScript4.dll!6dfdd786()    Unknown
QtCore4.dll!6daa17df()  Unknown
QtScript4.dll!6dfe6e7d()    Unknown
QtScript4.dll!6dfe7390()    Unknown
QtScript4.dll!6dfe745c()    Unknown
QtScript4.dll!6df5a020()    Unknown
QtScript4.dll!6df44e09()    Unknown
0a1f627e()  Unknown
uacompliancetest.exe!00bb136a() Unknown
uacompliancetest.exe!00bd0fde() Unknown
QtGui4.dll!65cb1301()   Unknown
QtCore4.dll!6dab803f()  Unknown
uacompliancetest.exe!00b516d4() Unknown
QtCore4.dll!6daaf316()  Unknown
QtGui4.dll!65c6c6be()   Unknown
QtGui4.dll!660081cb()   Unknown
QtGui4.dll!65f66099()   Unknown
QtGui4.dll!65f663ea()   Unknown
QtGui4.dll!66007fce()   Unknown
QtGui4.dll!65cc3f2b()   Unknown
QtGui4.dll!65f651d3()   Unknown
QtGui4.dll!66009020()   Unknown
QtGui4.dll!65c7fc19()   Unknown
QtGui4.dll!65c81555()   Unknown
user32.dll!__InternalCallWinProc@20()  Unknown
TagsNo tags attached.
Files Affected

Activities

Jochen Baier

2022-06-17 14:04

reporter   ~0016850

I want to use CTT in a CI environment for automatic testing. This bug makes this difficult to do.

Alexander Allmendinger

2022-06-21 10:34

developer   ~0016939

Please send the dump to compliance@opcfoundation.org and we'll see if we find something. But I suspect we will need a chance to reproduce the issue by receiving the user defined script and probably even the test target.

Jochen Baier

2022-07-22 09:16

reporter   ~0017172

During contact with Mr. Allmendinger who provided a exe with debug symbols I have now found the cause of the error:

I accidentally passed a too short array in UaVariant.setStringMatrix() (See Script).
UaVariant.setStringMatrix() does not check this. As a result, the internal array in UaVariant is too small. (1 string instead of 2 strings).

Write assumes that the array in the UaVariant is long enough and probably accesses heap memory that comes after the first string.
Depending on what is at this place in memory this works without error (this is the dynamic part).

On the server side this was not noticed because the corresponding test sub writes string ranges and the server detects this with
BadIndexRangeNoData (because not allowed). Thus the content of the array was not checked by the client.

UaVariant.setStringMatrix() should therefore check if the array has the correct size.

Script to reproduce. Tested with the demo server of the Unified Automation C++ SDK:

<code>
function test_write_matrix()
{
var node_id="ns=2;s=Demo.Static.Matrix.String"

//Vereinfachter Test (Zeigt auch den Fehler)
var index_range= '1,1,0:1' //Schreibt [1][1][0]="a", [1][1][1]="b": Good erwartet
//Dies entspricht dem Test bei der real Fehler auftrat: //Sub String ranges schrieben: BadIndexRangeNoData erwartet
//var index_range= '1,1,1,0:1'

var monitored_item= MonitoredItem.fromNodeIds(UaNodeId.fromString(node_id), undefined, index_range)[0];

var dimensions = new UaInt32s();
dimensions[0]=1;
dimensions[1]=1;
dimensions[2]=2;

var write_values = new UaStrings();
write_values[0]="a"
//write_values[1]="b" //ausversehen nur ein String Array mit einem Element angelegt

monitored_item.Value.Value.setStringMatrix( dimensions, write_values);

var res=WriteHelper.Execute( { NodesToWrite: monitored_item,
ServiceResults: new ExpectedAndAcceptedResults(StatusCode.Good),
OperationResults: new ExpectedAndAcceptedResults(StatusCode.Good),
ReadVerification: false });

if (!res)
{
addError( "Test write start value() failed" );
return false;
}

return true;
}
</code>

Test.Execute( { Procedure: test_write_matrix } );

You may have to run it a few times until it occurs. It occurs faster in the debugger.

Paul Hunkar

2022-08-04 14:55

administrator   ~0017277

We should ensure it does not crash (try/catch)

Paul Hunkar

2022-08-04 14:56

administrator   ~0017278

Will address this in a future release - not a high priority since script fixes can work around the problem

Issue History

Date Modified Username Field Change
2022-06-04 18:12 Jochen Baier New Issue
2022-06-17 14:04 Jochen Baier Note Added: 0016850
2022-06-21 10:34 Alexander Allmendinger Note Added: 0016939
2022-07-22 09:16 Jochen Baier Note Added: 0017172
2022-08-04 14:55 Paul Hunkar Note Added: 0017277
2022-08-04 14:56 Paul Hunkar Assigned To => Paul Hunkar
2022-08-04 14:56 Paul Hunkar Status new => acknowledged
2022-08-04 14:56 Paul Hunkar Note Added: 0017278
2022-08-05 14:28 Paul Hunkar Assigned To Paul Hunkar =>