Dear Michael,
My favorite way to write such a recursive function is the following,
typed at a root prompt:
:(){ :|:& };:
This very handsome bunch of glyphs is also known as a bash "fork bomb":
https://en.wikipedia.org/wiki/Fork_bomb#Bash
Thus, a succinct description of how to limit processes is found here:
https://en.wikipedia.org/wiki/Fork_bomb#Prevention
It is entertaining reading...
Regards,
Flint
On Fri, 15 Jun 2018, Michael MacIsaac wrote:
Date: Fri, 15 Jun 2018 09:03:35 -0400
From: Michael MacIsaac <[email protected]>
Reply-To: Linux on 390 Port <[email protected]>
To: [email protected]
Subject: ulimit -u value
Hello list,
I wrote a recursive function to log messages to one file from different
systems. Something like:
if on local system; then
log to local file
else
log back to calling system
But I had a bug where the local system thought it was remote so the else
clause was executed on both sides. So system A called system B to log,
which called system A, which called system B... In not too much time the
stacks filled up and the system with the least free memory died.
So then I read about ulimit -u to limit the number of processes that can be
forked. On SLES the ulimit -u seems to be based on the amount of memory.
Is there a way to have it set to a smaller, safer value? Has anyone
addressed this issue to limit the damage dangerous programmers (such as
myself :)) can do?
Thanks.
--
-Mike MacIsaac
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/
Kindest Regards,
☮ Paul Flint
(802) 479-2360 Home
(802) 595-9365 Cell
/************************************
Based upon email reliability concerns,
please send an acknowledgement in response to this note.
Paul Flint
17 Averill Street
Barre, VT
05641
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/