[issue45021] Race condition in thread.py

nullptr report at bugs.python.org
Thu Aug 26 16:55:48 EDT 2021


nullptr <xavier.lacroze at gmail.com> added the comment:

A more direct way to reproduce


from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
from time import sleep

def worker():
    with ProcessPoolExecutor() as pool:
        r = list(pool.map(sleep, [0.01] * 8))


def submit(pool):
    pool.submit(submit, pool)


if __name__ == '__main__':
    pool = ThreadPoolExecutor(2)
    pool.submit(submit, pool)

    i = 0
    while True:
        r = pool.submit(worker)
        r = r.result()
        print(i)
        i += 1

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45021>
_______________________________________


More information about the Python-bugs-list mailing list