cc: [EMAIL PROTECTED]
Subject: Re: [ast-developers] Reaching RLIMIT_NPROC on Linux ends with infinite 
 loop
--------

> Hello,
>   running the following script on Linux ends up in an infinite loop:
> 
> #!/bin/ksh
> ulimit -u 10
> for (( i = 0; i < 10; i++ )); do
>         cat /dev/zero > /dev/null &
> done
> 
> The shell seems to be spinning in xec.c:sh_fork() (line 2256 in my sources):
> 
>         while(_sh_fork(parent=fork(),flags,jobid) < 0);
> 
> ...and _sh_fork() returns always -1 in this situation because we have reached
> RLIMIT_NPROC limit and fork returns always -1.
> 
> Here's my attempt to fix the problem -- give up if errno is EAGAIN, which is
> the way e.g. bash seems to solve the situation.
> 
> 

I ran this script and with the current backup it fails after 30 seconds.
I beleive that it fork() fails six times.


David Korn
[EMAIL PROTECTED]
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to