Issue 7023: Marshal doesn't release GIL while dumping (original) (raw)

Issue7023

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

Files
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.
History
Date User Action Args
2022-04-11 14:56:53 admin set github: 51272
2009-09-30 14:23:00 benjamin.peterson set status: open -> closednosy: + benjamin.petersonmessages: + resolution: rejected
2009-09-30 12:46:56 amaury.forgeotdarc set nosy: + amaury.forgeotdarcmessages: +
2009-09-30 09:39:42 zengke set versions: + Python 2.6, Python 2.5, Python 2.4
2009-09-30 09:36:52 zengke create