Re: Recursively calling a bash script goes undetected and eats all syste
From:
Greg Wooledge
Subject:
Re: Recursively calling a bash script goes undetected and eats all system memory
Date:
Fri, 10 Dec 2010 08:29:43 -0500
User-agent:
Mutt/1.4.2.3i
On Fri, Dec 10, 2010 at 10:25:02AM +0100, Diggory Hardy wrote:
> Uh. Then over time it is legitimate to have a script recursively call itself
> a few thousand times with each instance still in memory?
No.
> The potential to grind the system to a complete halt is pretty serious
> though. Perhaps the ideal solution would be to have the kernel intervene
> before it starts thrashing memory, but that doesn't seem to happen.
Just use exec. Re-exec yourself instead of spawning a new instance of
yourself.