This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author maggyero
Recipients asvetlov, bquinlan, lukasz.langa, maggyero, methane, ned.deily, pitrou, serhiy.storchaka, vstinner
Date 2019-06-14.06:08:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1560492485.93.0.0515191207525.issue37276@roundup.psfhosted.org>
In-reply-to
Content
In the `concurrent.futures` standard module, the number of running calls in a `ProcessPoolExecutor` is `max_workers + 1` (unexpected) instead of `max_workers` (expected) like in a `ThreadingPoolExecutor`.

The following code snippet which submits 8 calls to 2 workers in a `ProcessPoolExecutor`:

    import concurrent.futures
    import time
    
    
    def call():
        while True:
            time.sleep(1)
    
    
    if __name__ == "__main__":
        with concurrent.futures.ProcessPoolExecutor(max_workers=2) as executor:
            futures = [executor.submit(call) for _ in range(8)]
    
            for future in futures:
                print(future.running())

prints this (3 running calls; unexpected since there are 2 workers):

> True
> True
> True
> False
> False
> False
> False
> False

while using a `ThreadPoolExecutor` prints this (2 running calls; expected):

> True
> True
> False
> False
> False
> False
> False
> False

Tested on both Windows 10 and MacOS 10.14.
History
Date User Action Args
2019-06-14 06:08:05maggyerosetrecipients: + maggyero, bquinlan, pitrou, vstinner, ned.deily, asvetlov, methane, lukasz.langa, serhiy.storchaka
2019-06-14 06:08:05maggyerosetmessageid: <1560492485.93.0.0515191207525.issue37276@roundup.psfhosted.org>
2019-06-14 06:08:05maggyerolinkissue37276 messages
2019-06-14 06:08:05maggyerocreate