Results 1 to 3 of 3

Thread: QProcess not working correctly

  1. #1
    Join Date
    May 2013
    Posts
    8
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QProcess not working correctly

    I am trying to run 100 instances of a program in the background. I get to 51 and my Qt app locks up with "QProcess : Destroyed while process is still running."

    So I am thinking that maybe I am running into some sort of linux max limit of something (memory, sockets, whatever). So I create a bash script that creates 100 instances of my app and puts each one in the background with no problem.

    And now I am stuck.

    Here is how I am calling it:

    Qt Code:
    1. {
    2. QProcess* process = new QProcess();
    3.  
    4. QString program = "my_program cmdline_option_1 cmdline_option_2";
    5. process->start(program);
    6. }
    To copy to clipboard, switch view to plain text mode 

    and this is called from a clicked() event.


    Added after 4 minutes:


    Maybe I should be using:

    Qt Code:
    1. process->startDetached(program);
    To copy to clipboard, switch view to plain text mode 


    Added after 30 minutes:


    Nothing to see here...move along......
    Last edited by m_bishop; 25th May 2013 at 01:25.

  2. #2
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QProcess not working correctly

    Quote Originally Posted by m_bishop View Post
    So I am thinking that maybe I am running into some sort of linux max limit of something (memory, sockets, whatever). So I create a bash script that creates 100 instances of my app and puts each one in the background with no problem.
    MAXIMUM NUMBER OF PROCESSES
    Qt Code:
    1. cat /proc/sys/kernel/pid_max
    To copy to clipboard, switch view to plain text mode 

    besides, start() runs the process if has not already been initiated.
    you may also check for standard error when writing your code, use the QProcess members like:

    Qt Code:
    1. QProcess::ProcessError Error = Prozess->error ();
    To copy to clipboard, switch view to plain text mode 

    http://qt-project.org/doc/qt-4.8/qpr...#startDetached

  3. #3
    Join Date
    May 2013
    Posts
    8
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QProcess not working correctly

    Ok, so I use the startDetached() and I can now create 68 instances, but no more than that. I get the 'QProcess: Destroyed while process is still running."

    Qt Code:
    1. cat /proc/sys/kernel/pid_max
    2.  
    3. 32768
    To copy to clipboard, switch view to plain text mode 

    I don't even have 300 PIDs when looking at 'top' or 'ps'.

    When I start my apps with startDetrached() I am creating a custom widget for each one that has 6 slots, but I think that isn't an issue - yet.

    Any idea what is going on?


    Added after 1 21 minutes:


    I tried:

    Qt Code:
    1. {
    2. QProcess* process = new QProcess();
    3.  
    4. QString program = "my_program cmdline_option_1 cmdline_option_2";
    5. process->startDetached(program);
    6. process->terminate();
    7. }
    To copy to clipboard, switch view to plain text mode 

    And I still can only run 68 instances of my app. It always does 'QProcess: Destroyed while process is still running.'
    Last edited by m_bishop; 28th May 2013 at 17:36.

Similar Threads

  1. stylesheet not working correctly
    By melody:p in forum Qt Programming
    Replies: 5
    Last Post: 3rd September 2012, 06:38
  2. setTabStopWidth not working correctly?
    By Kyosaur in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2012, 15:16
  3. QProcess failed invoke emulator correctly
    By boyInBox in forum Newbie
    Replies: 1
    Last Post: 23rd June 2011, 09:27
  4. Drop not working correctly
    By rippa in forum Qt Programming
    Replies: 2
    Last Post: 11th November 2008, 16:13
  5. renderText is not working correctly
    By validator in forum Qt Programming
    Replies: 3
    Last Post: 27th May 2008, 17:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.