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

QProcess::waitForFinished broken on MIPS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.5.1
    • Core: I/O
    • None
    • Debian GNU/Linux unstable
      Reproducible on mips, mipsel, mips64el
    • 110a8c339fa078a4edd09a70239280e482b149f1

    Description

      Qt 5.5.1 does not detect when a process exits on MIPS platform (mips, mipsel, mips64el).

      A small test case:

      #include <QtCore/QCoreApplication>
      #include <QtCore/QDateTime>
      #include <QtCore/QDebug>
      #include <QtCore/QProcess>
      
      #define MESSAGE_WITH_TIME qDebug() << (QDateTime::currentMSecsSinceEpoch() - startTime)
      
      int main(int argc, char **argv) {
          QCoreApplication a(argc, argv);
          qint64 startTime = QDateTime::currentMSecsSinceEpoch();
      
          QProcess p;
          p.start("/bin/true");
          MESSAGE_WITH_TIME << "Calling waitForStarted()";
          bool wfs = p.waitForStarted();
          MESSAGE_WITH_TIME << "waitForStarted() returned" << wfs;
          MESSAGE_WITH_TIME << "Calling waitForFinished()";
          bool wff = p.waitForFinished();
          MESSAGE_WITH_TIME << "waitForFinished() returned" << wff;
          MESSAGE_WITH_TIME << "errorString() is" << p.errorString();
          return 0;
      }
      

      Output (the number before a string is number of msecs since parent process start):

      3 Calling waitForStarted()
      21 waitForStarted() returned true
      22 Calling waitForFinished()
      30052 waitForFinished() returned false
      30052 errorString() is "Process operation timed out"
      QProcess: Destroyed while process ("/bin/true") is still running.
      

      Strace indicates that the child process exits almost immediately. Here are some fragments of strace -f output:

      clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x74eccc48) = 4891
      Process 4891 attached
      [pid  4890] write(2, "29 waitForStarted() returned tru"..., 34) = 34
      [pid  4890] write(2, "30 Calling waitForFinished()\n", 29) = 29
      [pid  4891] exit_group(0)               = ?
      [pid  4891] +++ exited with 0 +++
      <... pselect6 resumed> )                = ? ERESTARTNOHAND (To be restarted if no handler)
      --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=4891, si_uid=3286, si_status=0, si_utime=0, si_stime=0} ---
      waitid(P_ALL, 0, {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=4891, si_uid=3286, si_status=0, si_utime=0, si_stime=0}, WNOHANG|WEXITED|WNOWAIT, NULL) = 0
      waitid(P_PID, 1, 0x7fae18c4, WNOHANG|WEXITED, NULL) = -1 ECHILD (No child processes)
      waitid(P_ALL, 0, {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=4891, si_uid=3286, si_status=0, si_utime=0, si_stime=0}, WNOHANG|WEXITED|WNOWAIT, NULL) = 0
      

      Full strace output is attached.

      Because of this bug, Qt Build Suite failed to build on three MIPS architectures in Debian. I think it is a regression from Qt 5.4.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            mandriver Dmitry Shachnev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes