[New-bugs-announce] [issue41456] loop.run_in_executor creat thread but not destory it after the task run over

Guo Xiyong report at bugs.python.org
Sun Aug 2 02:40:35 EDT 2020


New submission from Guo Xiyong <beijiu572 at gmail.com>:

code like this:

import asyncio

import time

import threading


def sync_test():
    time.sleep(1)

async def run_test():
    loop = asyncio.get_event_loop()

    for _ in range(10):
    #     r = await loop.getaddrinfo('wq.io', 443)
    #     print(r)

        loop.run_in_executor(None, sync_test)

    for t in threading.enumerate():
        print(t)


    while True:
        await asyncio.sleep(1)


asyncio.run(run_test())


after run, the 10 thread will always exist

----------
components: asyncio
messages: 374679
nosy: asvetlov, cielpy, yselivanov
priority: normal
severity: normal
status: open
title: loop.run_in_executor creat thread but not destory it after the task run over
versions: Python 3.7

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


More information about the New-bugs-announce mailing list