You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2016-11-09.16:05:49.685>labels= ['type-bug']
title='concurrent.futures.ThreadPoolExecutor: tasks in queue not marked as done'updated_at=<Date2016-11-09.16:05:49.685>user='https://bugs.python.org/pyfm'
I just realized that the ThreadPoolExecutor's workers do not call task_done() on the work_queue from which they took their task.
Or is there a reason for not calling task_done that I am missing?
Calling task_done decrements the queue's unfinished_tasks counter which could be used to improve the reuse of idle threads (see bquinlan's comment, Lib/concurrent/futures/thread.py:l124).
I am thinking of something like
if self._work_queue.unfinished_tasks > len(self._threads) and len(self._threads) < self._max_workers:
One could still construct cases in which threads are created unnecessarily but it should improve the situation in most cases.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: