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 jaredlang
Recipients jaredlang, ronaldoussoren
Date 2010-08-24.13:23:18
SpamBayes Score 2.470335e-11
Marked as misclassified No
Message-id <1282656201.3.0.572219885558.issue9670@psf.upfronthosting.co.za>
In-reply-to
Content
Recursion within a thread on OSX can result in a crash by exceeding the systems recursion limit.  Recursion behaves as expected if not in thread, meaning it throws a RunTimeError with the message "maximum recursion depth exceeded."

The crash is able to be avoided if the recursion limit is set to a lower number, ie. 800, via sys.setrecursionlimit.

Example program which crashes on OSX:


>>> def f():
...     return f()
... 
>>> import threading
>>> thread = threading.Thread(target=f)
>>> thread.start()
Bus error


Alternatively, the following works as expected:


>>> import sys
>>> def f():
...     return f()
... 
>>> import threading
>>> thread = threading.Thread(target=f)
>>> sys.setrecursionlimit(800)
>>> thread.start()

>>> Exception in thread Thread-1:
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.py", line 484, in run
    self.__target(*self.__args, **self.__kwargs)
  File "<stdin>", line 2, in f
  File "<stdin>", line 2, in f
  File "<stdin>", line 2, in f
  File "<stdin>", line 2, in f
  File "<stdin>", line 2, in f
  File "<stdin>", line 2, in f
...

RuntimeError: maximum recursion depth exceeded
History
Date User Action Args
2010-08-24 13:23:21jaredlangsetrecipients: + jaredlang, ronaldoussoren
2010-08-24 13:23:21jaredlangsetmessageid: <1282656201.3.0.572219885558.issue9670@psf.upfronthosting.co.za>
2010-08-24 13:23:18jaredlanglinkissue9670 messages
2010-08-24 13:23:18jaredlangcreate