Skip to content

ProcessPoolExecutor child process problem in windows #109124

@pullgon

Description

@pullgon

Bug report

Bug description:

Operating system:Win10

import os
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor

print(f"001 at {os.getpid()}")


def task():
    print("hello world")


# print("002")
if __name__ == '__main__':
    print(f"002 --- {os.getpid()}")
    pool = ProcessPoolExecutor(max_workers=10)
    pool.submit(task, *())
    pool.shutdown(True)

Unexpected output,Why does 001 appear twice?

001 at 18836
002 --- 18836
001 at 68124
hello world

I tried it on linux without any problems,I guess ProcessPoolExecutor is not so friendly for windows support.

CPython versions tested on:

3.8, 3.10, 3.11

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions