Issue 1430436: recursive getattr in thread crashes (original) (raw)

Created on 2006-02-13 04:35 by aaronsw, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
crashtest.py aaronsw,2006-02-13 04:44
Messages (6)
msg27505 - (view) Author: Aaron Swartz (aaronsw) Date: 2006-02-13 04:35
The following code consistently crashes Python 2.4 on Mac OS X: import threading class foo: def __getattr__(self, x): self.foo def j(): foo().bar t = threading.Thread(target=j, args=()) t.start()
msg27506 - (view) Author: Aaron Swartz (aaronsw) Date: 2006-02-13 04:41
Logged In: YES user_id=122141 I've also tested it on FreeBSD and it has the same problem (Segmentation fault (core dumped)).
msg27507 - (view) Author: Aaron Swartz (aaronsw) Date: 2006-02-13 04:44
Logged In: YES user_id=122141 Since the indenting was off above, I've attached the code.
msg27508 - (view) Author: aix-d (aix-d) Date: 2006-02-19 22:40
Logged In: YES user_id=1449422 Hello. I have the same segfault :-( Python version: from SVN Python 2.5a0 (trunk, Feb 19 2006, 22:22:12) [GCC 3.4.4 [FreeBSD] 20050518] on freebsd6 Best regards, Alexander.
msg57521 - (view) Author: (bwpy) Date: 2007-11-15 08:36
I can still reproduce this on FreeBSD 7.0 BETA2. Python version is Python 2.5.1 (r251:54863, Nov 14 2007, 13:09:04) [GCC 4.2.1 20070719 [FreeBSD]] on freebsd7
msg57560 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2007-11-15 20:44
And under 2.6 on OS X. I doubt this is a BSD thing but more of a recursion depth issue. And I don't think there is anything to fix here. The recursion depth is a per-thread thing, and this test is blowing the C stack before the recursion depth is reached. If you drop the recursion limit lower the proper exception is raised (I had to drop mine down to 400 to trigger the exception). So this is not a Python issue, per-se, just a limitation of the C stack and how things are implemented. While we do everything we can to prevent crashes, this just can't be helped as the C stack is not under our control. Closing as invalid.
History
Date User Action Args
2022-04-11 14:56:15 admin set github: 42897
2007-11-15 20:44:40 brett.cannon set status: open -> closedversions: + Python 2.6nosy: + brett.cannontitle: recursive __getattr__ in thread crashes BSDs -> recursive __getattr__ in thread crashesmessages: + resolution: not a bug
2007-11-15 08:36:16 bwpy set nosy: + bwpymessages: + versions: + Python 2.5
2006-02-13 04:35:59 aaronsw create