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.

classification
Title: Fatal error on thread creation in low memory condition: local storage
Type: crash Stage:
Components: Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: low Keywords:

Created on 2010-03-22 01:08 by vstinner, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg101474 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-03-22 01:08
I wrote a patch to preallocate Python thread state before creating the thread to avoid a fatal error: issue7544 (it's now closed). This patch is not enough to avoid fatal errors in low memory condition.

Just after the creation of the thread, _PyGILState_NoteThreadState() is called. This function can fail with a fatal error (Couldn't create autoTLSkey mapping) in low memory condition if a memory allocation fails in find_key(), called by PyThread_set_key_value().

PyThread_set_key_value() fills a global single linked list of type 'struct key', the head is 'keyhead'. This list contains values and uses an index composed of (long thread id, int key). Only one key is used: autoTLSkey (0). The list is used to get the thread state (eg. in PyGILState_Ensure).

Note: This issue is very unlikely, but it does exist :-)
msg116052 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-09-10 22:29
I don't know how to fix this issue, and I don't know if it can be fixed. As the issue is very unlikely, I prefer to close it.
History
Date User Action Args
2022-04-11 14:56:58adminsetgithub: 52444
2010-09-10 22:29:29vstinnersetstatus: open -> closed
resolution: wont fix
messages: + msg116052
2010-03-22 01:16:44vstinnersetpriority: low
title: Fatal error on thread creation in low memory condition (2) -> Fatal error on thread creation in low memory condition: local storage
2010-03-22 01:08:23vstinnercreate