Author neologix
Recipients Mark.Gius, gregory.p.smith, jcea, neologix
Date 2012-10-26.06:04:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
> No automated testing included because I'm not entirely sure how to replicate this without eating up a ton of ram or doing something naughty with ulimit.

Simply use RLIMIT_NPROC, from a subprocess:
$ cat /tmp/
import subprocess

ps = [ ]

for i in range(1024):
    p = subprocess.Popen(['sleep', '10'])
$ python /tmp/
Traceback (most recent call last):
  File "/tmp/", line 7, in ?
    p = subprocess.Popen(['sleep', '10'])
  File "/usr/lib64/python2.4/", line 550, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.4/", line 919, in _execute_child = os.fork()
OSError: [Errno 11] Resource temporarily unavailable
$ ulimit -u 1024

Not POSIX, but supported by Linux and BSD, which should be enough.

The problem with monkey-ptching is that you don't test the real
codepath, and it may break in a future version (especially since here
it would be using a preivate API).
Date User Action Args
2012-10-26 06:04:14neologixsetrecipients: + neologix, gregory.p.smith, jcea, Mark.Gius
2012-10-26 06:04:14neologixlinkissue16327 messages
2012-10-26 06:04:14neologixcreate