Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85939

Qt Opcua failing tests on Windows MSVC when building with CMake

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 6.0 (Next Major Release)
    • Fix Version/s: None
    • Component/s: Build System: CMake, OpcUA
    • Labels:

      Description

      See failing integrations at https://codereview.qt-project.org/c/qt/qtopcua/+/309547

      The Opcua test server fails to launch on Windows + MSVC + CMake, with a "could not initialize server" error.

      A lot of time was spent to investigate why, and it seems that building open62541.c with optimizations is the culprit. qmake builds disabled optimizations for that file, and it works fine.

      Here's the stack trace where it fails with allocating memory.

      open62541-testserver.exe!UA_Array_copy(const void * src, unsigned __int64 size, void * * dst, const UA_DataType * type) Line 8334 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:8334)
      open62541-testserver.exe!String_copy(const UA_String * src, UA_String * dst, const UA_DataType * _) Line 7315 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:7315)
      open62541-testserver.exe!UA_copy(const void * src, void * dst, const UA_DataType * type) Line 8228 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:8228)
      [Inline Frame] open62541-testserver.exe!UA_String_copy(const UA_String *) Line 16615 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.h:16615)
      open62541-testserver.exe!LocalizedText_copy(const UA_LocalizedText * src, UA_LocalizedText * dst, const UA_DataType * _) Line 8058 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:8058)
      open62541-testserver.exe!copyStructure(const void * src, void * dst, const UA_DataType * type) Line 8164 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:8164)
      open62541-testserver.exe!UA_copy(const void * src, void * dst, const UA_DataType * type) Line 8228 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:8228)
      open62541-testserver.exe!UA_Array_copy(const void * src, unsigned __int64 size, void * * dst, const UA_DataType * type) Line 8345 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:8345)
      open62541-testserver.exe!Variant_copy(const UA_Variant * src, UA_Variant * dst, const UA_DataType * _) Line 7688 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:7688)
      open62541-testserver.exe!UA_copy(const void * src, void * dst, const UA_DataType * type) Line 8228 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:8228)
      [Inline Frame] open62541-testserver.exe!UA_Variant_copy(const UA_Variant *) Line 16990 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.h:16990)
      open62541-testserver.exe!copyCommonVariableAttributes(UA_VariableNode * node, const UA_VariableAttributes * attr) Line 20673 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:20673)
      open62541-testserver.exe!UA_Node_setAttributes(UA_Node * node, const void * attributes, const UA_DataType * attributeType) Line 20758 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:20758)
      open62541-testserver.exe!AddNode_raw(UA_Server * server, UA_Session * session, void * nodeContext, const UA_AddNodesItem * item, UA_NodeId * outNewNodeId) Line 35811 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:35811)
      open62541-testserver.exe!Operation_addNode_begin(UA_Server * server, UA_Session * session, void * nodeContext, const UA_AddNodesItem * item, const UA_NodeId * parentNodeId, const UA_NodeId * referenceTypeId, UA_NodeId * outNewNodeId) Line 35847 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:35847)
      open62541-testserver.exe!UA_Server_addNode_begin(UA_Server * server, const UA_NodeClass nodeClass, const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId, const UA_QualifiedName browseName, const UA_NodeId typeDefinition, const void * attr, const UA_DataType * attributeType, void * nodeContext, UA_NodeId * outNewNodeId) Line 36270 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:36270)
      open62541-testserver.exe!function_namespace0_generated_34_begin(UA_Server * server, wchar_t * ns) Line 43193 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:43193)
      open62541-testserver.exe!namespace0_generated(UA_Server * server) Line 46744 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:46744)
      open62541-testserver.exe!UA_Server_initNS0(UA_Server * server) Line 22451 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:22451)
      open62541-testserver.exe!UA_Server_init(UA_Server * server) Line 21266 (c:\Users\qt\work\qt\qtopcua\src\3rdparty\open62541\open62541.c:21266)
      

      The flow goes somewhat like UA_Server_initNS0 -> function_namespace0_generated_34_begin -> Operation_addNode_begin -> UA_STATUSCODE_BADOUTOFMEMORY (2147680256)

      It appears it was accidentally fixed like that in qmake as a drive by for fixing another issue

      https://bugreports.qt.io/browse/QTBUG-75020

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              alexandru.croitor Alexandru Croitor
              Reporter:
              alexandru.croitor Alexandru Croitor
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes