This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <CAH_1eM0d8LM72b30Nq45cbSiBvYmZmmZRqeNFD-9JeJHZdZ9Lg@mail.gmail.com>
In-reply-to <1351204263.29.0.689540716038.issue16327@psf.upfronthosting.co.za>
Content
> 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/test.py
import subprocess

ps = [ ]

for i in range(1024):
    p = subprocess.Popen(['sleep', '10'])
    ps.append(p)
$ python /tmp/test.py
Traceback (most recent call last):
  File "/tmp/test.py", line 7, in ?
    p = subprocess.Popen(['sleep', '10'])
  File "/usr/lib64/python2.4/subprocess.py", line 550, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.4/subprocess.py", line 919, in _execute_child
    self.pid = 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).
History
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