[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 busy-waiting when idle.
type: resource usage
versions: Python 3.7

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



[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 tracker 
<https://bugs.python.org/issue39557>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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

--

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