[Spambayes] seg faults?

Skip Montanaro skip at pobox.com
Tue Jan 28 16:08:09 EST 2003


    Richie> [Tony]
    >> sh: ulimit -s 2048
    >> Would it be desirable to have pop3proxy.py take care of this?

    Richie> Is that possible?  Can a process increase its own stack size?
    Richie> Or would we need a shellscript wrapper?  Any Mac OS X users
    Richie> fancy taking on the job?

This topic came up on python-dev.  The conclusion there was that the
regression test script should take care of this for its own needs, but not
to do this in general.  Here's the relevant code from Lib/test/regrtest.py:

    # MacOSX (a.k.a. Darwin) has a default stack size that is too small
    # for deeply recursive regular expressions.  We see this as crashes in
    # the Python test suite when running test_re.py and test_sre.py.  The
    # fix is to set the stack limit to 2048.
    # This approach may also be useful for other Unixy platforms that
    # suffer from small default stack limits.
    if sys.platform == 'darwin':
        try:
            import resource
        except ImportError:
            pass
        else:
            soft, hard = resource.getrlimit(resource.RLIMIT_STACK)
            newsoft = min(hard, max(soft, 1024*2048))
            resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard))

Skip



More information about the Spambayes mailing list