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.

Title: Marshal doesn't release GIL while dumping
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.4, Python 2.7, Python 2.6, Python 2.5
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, benjamin.peterson, zengke
Priority: normal Keywords: patch

Created on 2009-09-30 09:36 by zengke, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
marshal_threads.patch zengke, 2009-09-30 09:36 A patch that would help.
Messages (3)
msg93354 - (view) Author: zengke (zengke) Date: 2009-09-30 09:36
If marshal.dumps() is handling a large data, It keeps acquiring the GIL
and may take several seconds, Other threads therefor are blocked.
marshal.loads should also be friendly to other threads.
msg93362 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-09-30 12:46
The patch is wrong; the function allows other threads to run while it
calls _PyString_Resize(), this will lead to crashes.
msg93367 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-09-30 14:23
In fact, almost no place in marhsal is thread safe, so releasing the GIL
anywhere is not safe.
Date User Action Args
2022-04-11 14:56:53adminsetgithub: 51272
2009-09-30 14:23:00benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg93367

resolution: rejected
2009-09-30 12:46:56amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg93362
2009-09-30 09:39:42zengkesetversions: + Python 2.6, Python 2.5, Python 2.4
2009-09-30 09:36:52zengkecreate