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

QProcess Leaks FD if non existence binary is executed

XMLWordPrintable

    • Linux/X11
    • 82b75570f099911076ad0e144927862e8e359fbd (qtbase/dev) b5982b6525c7c24e51e41ba2055c4626d0c2fce3 (qtbase/6.5)

      If QProcess is called with non existence command/binary it leaks file descriptor.

       void testfn() 
      { 
      QProcess process; 
      process.start("nonexistingcommand"); 
      process.waitForFinished(); 
      process.closeReadChannel(QProcess::StandardOutput); process.closeReadChannel(QProcess::StandardError); 
      process.closeWriteChannel(); 
      process.close(); 
      }
      
      int main(int argc, char** argv) 
      { 
      QCoreApplication app(argc, argv);
      for(int i = 0; i < 10; ++i){ 
      testfn()
      }
      return 0; 
      }

      When  diffing the 'lsof' output between two timepoints, You get following difference:

      +lumon 1609604 fery 82w FIFO 0,14 0t0 35522629 pipe
      +lumon 1609604 fery 83w FIFO 0,14 0t0 35522633 pipe
      +lumon 1609604 fery 84w FIFO 0,14 0t0 35522637 pipe
      +lumon 1609604 fery 85w FIFO 0,14 0t0 35522244 pipe
      +lumon 1609604 fery 86w FIFO 0,14 0t0 35522248 pipe
      +lumon 1609604 fery 87w FIFO 0,14 0t0 35522252 pipe

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

            thiago Thiago Macieira
            irfan.omair@digia.com Irfan Omair
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes