summaryrefslogtreecommitdiffstats
path: root/Lib/concurrent/futures/process.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-05-02 22:51:20 (GMT)
committerGitHub <noreply@github.com>2022-05-02 22:51:20 (GMT)
commit51b885a38a6cbf1d11d3c49e0d2c6532944fcd4d (patch)
treeb35b5ef236f9177eb73d2e1b8827d91793306c67 /Lib/concurrent/futures/process.py
parent3fe4e4602ddc84569ea44384812667c0657c9bdb (diff)
downloadcpython-51b885a38a6cbf1d11d3c49e0d2c6532944fcd4d.zip
cpython-51b885a38a6cbf1d11d3c49e0d2c6532944fcd4d.tar.gz
cpython-51b885a38a6cbf1d11d3c49e0d2c6532944fcd4d.tar.bz2
bpo-46787: Fix `ProcessPoolExecutor exception` memory leak (GH-31408) (GH-31408)
Do not store `ProcessPoolExecutor` work item exception traceback that prevents exception frame locals from being garbage collected. (cherry picked from commit 9c204b148fad9742ed19b3bce173073cdec79819) Co-authored-by: themylogin <themylogin@gmail.com>
Diffstat (limited to 'Lib/concurrent/futures/process.py')
-rw-r--r--Lib/concurrent/futures/process.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py
index a29e524..e574299 100644
--- a/Lib/concurrent/futures/process.py
+++ b/Lib/concurrent/futures/process.py
@@ -126,6 +126,9 @@ class _ExceptionWithTraceback:
tb = traceback.format_exception(type(exc), exc, tb)
tb = ''.join(tb)
self.exc = exc
+ # Traceback object needs to be garbage-collected as its frames
+ # contain references to all the objects in the exception scope
+ self.exc.__traceback__ = None
self.tb = '\n"""\n%s"""' % tb
def __reduce__(self):
return _rebuild_exc, (self.exc, self.tb)