◐ Shell
reader mode source ↗
Skip to content

bpo-31249: Fix ref cycle in ThreadPoolExecutor#3178

Merged
vstinner merged 4 commits into
python:masterfrom
vstinner:futures_cycle
Aug 22, 2017
Merged

bpo-31249: Fix ref cycle in ThreadPoolExecutor#3178
vstinner merged 4 commits into
python:masterfrom
vstinner:futures_cycle

Conversation

@vstinner

@vstinner vstinner commented Aug 22, 2017

Copy link
Copy Markdown
Member

WorkItem.run() of concurrent.futures used by ThreadPoolExecutor now
breaks a reference cycle between an exception object and the WorkItem
object.

ThreadPoolExecutor.shutdown(wait=True) now also clears the set of
threads.

https://bugs.python.org/issue31249

concurrent.futures: WorkItem.run() used by ThreadPoolExecutor now
breaks a reference cycle between an exception object and the WorkItem
object. ThreadPoolExecutor.shutdown() now also clears its threads
set.
@vstinner

Copy link
Copy Markdown
Member Author

@gpshead, @pitrou: What do you think of the added "self._threads.clear()" statement?

@vstinner vstinner merged commit bc61315 into python:master Aug 22, 2017
@vstinner vstinner deleted the futures_cycle branch August 22, 2017 14:50
@gpshead

gpshead commented Aug 29, 2017

Copy link
Copy Markdown
Member

given I didn't respond earlier and I see no more self._threads.clear() in the accepted change, this change looks good to me. 👍

@Mariatta

Mariatta commented Sep 6, 2017

Copy link
Copy Markdown
Member

Already backported in #3253 so I'm removing the label.

GadgetSteve pushed a commit to GadgetSteve/cpython that referenced this pull request Sep 10, 2017
* bpo-31249: Fix ref cycle in ThreadPoolExecutor

concurrent.futures: WorkItem.run() used by ThreadPoolExecutor now
breaks a reference cycle between an exception object and the WorkItem
object. ThreadPoolExecutor.shutdown() now also clears its threads
set.

* shutdown() now only clears threads if wait is true.

* Revert changes on shutdown()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants