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

Possible deadlock at QtWebEngine Startup

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.15.5
    • WebEngine
    • None
    • Windows 10 64bit, Intel UHD 630 graphics driver, reproduced with version 27.20.100.8681 and 30.0.100.9684
    • Windows

    Description

      When opening a Qt window containing the QtWebView, during initialization, there is a potential deadlock. See the callstacks of 2 threads (attached pics):

      • Thread 1 is the normal Qt Gui thread
        opengl32.dll!wglSetPixelFormat -> ig9icd64.dll
      • Thread 2 is the WebEngine GPU thread
        ig9icd64.dll -> opengl32.dll!wglSetPixelFormat

      Both stuck in a critical section, obviously a classic deadlock.

      ig9icd64.dll is the graphics driver for Intel UHD 630 graphics chip.

      The problem occurs not deterministically, but (at least on one pc) quite often.

      Suggested solution: Somehow synchronize the 2 threads, so that SetPixelFormat is not called parallel, but in sequence.

       

      This is the code creating the Qt Dialog with the QtWebView (your web fronted is removing the newlines, sorry):

       

      QWidget* HtmlDialogQt::OpenDialogWindow(QWidget* dlgwnd){ 
          dlgwnd->resize(800, 600); 
          QGridLayout* gridLayout = new QGridLayout();
          dlgwnd->setLayout(gridLayout);
          QWebEngineView* webwidget = new QWebEngineView();
          gridLayout->addWidget(webwidget);
          QString path = Util::UnicodeToUTF8(m_uri.c_str()).c_str();
          if (path.startsWith(L"http")) 
              webwidget->setUrl(QUrl(path));
          else 
              webwidget->setUrl(QUrl::fromLocalFile(path)); 
          webwidget->setParent(dlgwnd);
          QPushButton* closeButton = new QPushButton("Close");
          closeButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
          gridLayout->addWidget(closeButton, 1, 0, Qt::AlignHCenter);
          QObject::connect(closeButton, &QPushButton::clicked, this, &HtmlDialogQt::slotCloseButtonClicked);  
          dlgwnd->show(); 
          return closeButton;
      }
      

      Thread 2 is started by setUrl()

      Thread 1 is show();

       

      Attachments

        1. 95568.txt
          19 kB
        2. QtWebEngineDeadlock1.png
          QtWebEngineDeadlock1.png
          211 kB
        3. QtWebEngineDeadlock2.png
          QtWebEngineDeadlock2.png
          152 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt_webengine_team Qt WebEngine Team
            daniel_frey Daniel Frey
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes