[issue39557] ThreadPoolExecutor is busy-waiting when idle.

2020-02-20 Thread Maor Kleinberger
Maor Kleinberger added the comment: > If I understand the following code correctly, there seems to be a busy loop > waiting for the SimpleQueue.put to signal that an item was entered to queue. This is not a busywait. Actually, the loop you specified will never repeat more than twice. At the

[issue39557] ThreadPoolExecutor is busy-waiting when idle.

2020-02-05 Thread Avraham Mahfuda
Avraham Mahfuda added the comment: If I understand the following code correctly, there seems to be a busy loop waiting for the SimpleQueue.put to signal that an item was entered to queue. https://github.com/python/cpython/blob/3.7/Modules/_queuemodule.c#L217 -- __

[issue39557] ThreadPoolExecutor is busy-waiting when idle.

2020-02-05 Thread Avraham Mahfuda
Avraham Mahfuda added the comment: 1. I can confirm that the posted code above is the correct one. 2. The 100% CPU was observed in a docker instance using python:3.7.0-alpine3.8 image. 3. The docker image was running on a 2 cores VM. -- ___ Python

[issue39557] ThreadPoolExecutor is busy-waiting when idle.

2020-02-05 Thread Mark Dickinson
Mark Dickinson added the comment: It would also be helpful to know which platform you're observing the 100% CPU usage on, so that we can try to reproduce. -- ___ Python tracker _

[issue39557] ThreadPoolExecutor is busy-waiting when idle.

2020-02-05 Thread Mark Dickinson
Mark Dickinson added the comment: On the HEAD of the current 3.7 branch, the file you refer to has the following code starting at line 37: while True: work_item = work_queue.get(block=True) if work_item is not None: work_item.run()

[issue39557] ThreadPoolExecutor is busy-waiting when idle.

2020-02-04 Thread Avraham Mahfuda
New submission from Avraham Mahfuda : In concurrent.futures.thread line 78 is busy-waiting if the queue is empty, which may cause the CPU to spin to 100% when idle. -- messages: 361410 nosy: Avraham Mahfuda priority: normal severity: normal status: open title: ThreadPoolExecutor is bus