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

QOpcUaClient (Open62541Backend) consumes too much CPU when subscription is made even if no data is changing.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 5.15
    • 5.14.1
    • OpcUA
    • None
    • Open62541Backend
    • All
    • d373a291e6d90b2ff01ec5ac80990e483e7408e2

    Description

      QOpcUaClient consumes too much CPU when subscription is created even if no data is changing.

      Looking into code, I have found following lines in qopen62541backend.cpp:1013

      void Open62541AsyncBackend::sendPublishRequest()
      {
       if (!m_uaclient)
       return;
      
      if (!m_sendPublishRequests) {
       return;
       }
      
      // If BADSERVERNOTCONNECTED is returned, the subscriptions are gone and local information can be deleted.
       if (UA_Client_run_iterate(m_uaclient, 1) == UA_STATUSCODE_BADSERVERNOTCONNECTED) {
       qCWarning(QT_OPCUA_PLUGINS_OPEN62541) << "Unable to send publish request";
       m_sendPublishRequests = false;
       cleanupSubscriptions();
       return;
       }
      
      m_subscriptionTimer.start(0);
      }
      

       
      my understanding is that calling UA_Client_run_iterate with timeout 1 msec and start timer with interval 0 msec afterwards causes that this function is called almost like busy-loop and cause 12% CPU load on my box.

      Note

      QObject::connect(&m_subscriptionTimer, &QTimer::timeout,
                           this, &Open62541AsyncBackend::sendPublishRequest);
      

      in Open62541AsyncBackend::Open62541AsyncBackend

       

       

      Attachments

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

        Activity

          People

            fmeerkoetter Frank Meerkötter
            fanda Fanda Vacek
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes