[issue27448] Race condition in subprocess.Popen which causes a huge memory leak

Glen Walker report at bugs.python.org
Wed May 2 23:59:16 EDT 2018


Glen Walker <glen at walker.gen.nz> added the comment:

Correct me if I'm wrong, the change released in Python 2.7.15 doesn't actually fix this race condition.

The race is:
* T1: gc_was_enabled = gc.isenabled() # True 
* T1: gc.disable()
* T2: gc_was_enabled = gc.isenabled() # False
* T1: gc.enable()
* T2: gc.disable()

To fix the race condition _disabling_gc_lock must also be held for gc.enable() in both call locations so it cannot happen between gc.isenabled() and gc.disable().

TBH, I'm not really expecting this to be fixed, this is more a note for any future travelers who come across this issue.

----------
nosy: +gwalker

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue27448>
_______________________________________


More information about the Python-bugs-list mailing list