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 Albert.Zeyer
Recipients Albert.Zeyer
Date 2013-02-21.02:37:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1361414271.61.0.154662693899.issue17263@psf.upfronthosting.co.za>
In-reply-to
Content
If you have some Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS in some tp_dealloc and you use such objects in thread local storage, you might get crashes, depending on which thread at what time is trying to cleanup such object.

I haven't fully figured out the details but I have a somewhat reduced testcase. Note that I encountered this in practice because the sqlite connection object does that (while it disconnects, the GIL is released).

This is the C code with some dummy type which has a tp_dealloc which just sleeps for some seconds while the GIL is released: https://github.com/albertz/playground/blob/master/testcrash_python_threadlocal.c

This is the Python code: https://github.com/albertz/playground/blob/master/testcrash_python_threadlocal_py.py

The Python code also contains some code path with a workaround which I'm using currently to avoid such crashes in my application.
History
Date User Action Args
2013-02-21 02:37:51Albert.Zeyersetrecipients: + Albert.Zeyer
2013-02-21 02:37:51Albert.Zeyersetmessageid: <1361414271.61.0.154662693899.issue17263@psf.upfronthosting.co.za>
2013-02-21 02:37:51Albert.Zeyerlinkissue17263 messages
2013-02-21 02:37:50Albert.Zeyercreate