bugGNU Parallel - build and execute command lines from standard input in parallel - Bugs: bug #34954, --timeout should kill process...

 
 

bug #34954: --timeout should kill process groups

Submitted by:  David <dwhughes>
Submitted on:  Wed 30 Nov 2011 07:47:47 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Ole Tange <tange>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 10 Dec 2011 12:43:42 AM UTC, comment #4:

Fixed in [8a7f45c6a]. It needs to be tested on different platforms though.

Ole Tange <tange>
Project AdministratorIn charge of this item.
Fri 09 Dec 2011 02:59:32 PM UTC, comment #3:

Using family_pids this now works on Linux.

parallel --timeout 10 "true ; perl -e '\$a=1;while(\$a<{}){\$a++}'" ::: 1000000000 1000000001

It needs to be tested on other OS's.

Ole Tange <tange>
Project AdministratorIn charge of this item.
Wed 30 Nov 2011 11:15:07 PM UTC, comment #2:

CTRL-Z does not work if using the command 'timeout':

parallel -q timeout 10 perl -e '$a=1;while($a<{}){$a++}' ::: 1000000000 1000000001
<CTRL-Z>
top

However, using the command 'timeout' does not leave hanging children:

parallel -q timeout 10 perl -e '$a=1;while($a<{}){$a++}' ::: 1000000000 1000000001 & sleep 11; ps f -t $(tty) -o pid,pgid,args

Also it does not involve creating and maintaining a separate version of 'open3'. So this approach is preferable over creating a separate version of 'open3'.

To see if sacrifying CTRL-Z is acceptable I will ask the email list.

Ole Tange <tange>
Project AdministratorIn charge of this item.
Wed 30 Nov 2011 08:48:36 PM UTC, comment #1:

When this is implemented test that CTRL-Z still suspends children. This is more important than --timeout working. Maybe --timeout should simply run the command timeout (with the needed quoting) instead?

Ole Tange <tange>
Project AdministratorIn charge of this item.
Wed 30 Nov 2011 07:47:47 PM UTC, original submission:

On command timeout, 'parallel' kills only the PID directly started by open3(). This is very liable to leave behind a mess of orphaned subprocesses.

Illustration. The '; true' is there to force the shell to run the 'sleep' as a subprocesses rather than exec()ing it. On timeout, 'parallel' kills the shell, leaving the orphaned 'sleep'.

Instead, 'parallel' should fork() and setpgrp(), and on timeout it should kill -$pid.

This appears to mean rolling our own open3(), but it's worth it.

Without this behaviour, the --timeout option is of limited use.


David <dwhughes>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by tange (Posted a comment)
  • -unavailable- added by dwhughes (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 10 Dec 2011 12:43:42 AM UTCtangeStatusNone=>Fixed
      Assigned toNone=>tange
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1