[issue44188] ThreadPoolExecutor unbalanced semaphore count

2021-05-20 Thread Bennie Swart


New submission from Bennie Swart :

The concurrent.futures.ThreadPoolExecutor class, which is the default asyncio 
executor, introduced the _idle_semaphore field in version 3.8 in order to track 
idle threads so they can be reused before increasing the pool size 
unnecessarily.
This semaphore counter becomes unbalanced when the thread pool is 
over-saturated, as can be seen in the file provided. This is due to workers 
always incrementing the count after finishing a job, whereas the executor only 
decrements the count if it is already greater than 0.
This seems to be a logic bug unrelated to the running environment and 
introduced since python 3.8.

--
components: asyncio
files: bug.py
messages: 394017
nosy: asvetlov, bennieswart, yselivanov
priority: normal
severity: normal
status: open
title: ThreadPoolExecutor unbalanced semaphore count
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file50054/bug.py

___
Python tracker 
<https://bugs.python.org/issue44188>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44188] ThreadPoolExecutor unbalanced semaphore count

2021-05-20 Thread Bennie Swart


Change by Bennie Swart :


--
keywords: +patch
pull_requests: +24869
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26265

___
Python tracker 
<https://bugs.python.org/issue44188>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com