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

QWindowsPipeWriter terminate process to early.

XMLWordPrintable

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

      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!

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes