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

QWindowsPipeWriter terminate process to early.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.8.1
    • 4.5.2
    • Core: I/O
    • None
    • 0f3d46b43f344abd8e158166c0e391ef404f2e2d

    Description

      I have found a problem that randomly happens. It's subbtle but the fix is easy. This is related to QProcess.
      When ending a process, Qt does some cleanup, and among others, the following code is executed:

      QWindowsPipeWriter::~QWindowsPipeWriter()
      {
          lock.lock();
          quitNow = true;
          waitCondition.wakeOne();
          lock.unlock();
          if (!wait(100))
              terminate();
      #if !defined(Q_OS_WINCE) || (_WIN32_WCE >= 0x600)
          CloseHandle(writePipe);
      #endif
      }
      
      

      This is in file "qwindowspipewriter.cpp". The code is ok but wait(100) is not enough. Most of the time 100 ms is enough, but sometimes this is not. In that case terminate() is called (this is a thread), which is not the recommanded way to end a thread. And in my case this has very bad side-effects!!!
      I don't have the problem if I set wait(1000) instead of wait(100).

      I suggest that you do this change. Relying on a 100 ms timeout is certainly not a good choice when an application is running heavily!

      Attachments

        For Gerrit Dashboard: QTBUG-4425
        # Subject Branch Project Status CR V

        Activity

          People

            xcm Martin Petersson (Inactive)
            xcm Martin Petersson (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes