classification
Title: test_asyncio reports reference leak
Type: Stage: resolved
Components: Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: haypo, xiang.zhang, yselivanov
Priority: normal Keywords:

Created on 2017-04-20 06:54 by xiang.zhang, last changed 2017-05-15 05:19 by xiang.zhang. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1413 merged xiang.zhang, 2017-05-03 04:19
PR 1584 merged xiang.zhang, 2017-05-15 04:02
PR 1585 merged xiang.zhang, 2017-05-15 04:02
Messages (5)
msg291951 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-04-20 06:54
Running test suite with refleak hunter reports test_asyncio leaks referrences:

0:00:00 [1/1] test_asyncio
Executing <Task finished coro=<CoroutineTests.test_async_def_wrapped.<locals>.start() done, defined at /home/angwer/repos/cpython/Lib/test/test_asyncio/test_pep492.py:150> result=None created at /home/angwer/repos/cpython/Lib/asyncio/base_events.py:445> took 0.123 seconds
beginning 9 repetitions
123456789
Executing <Task finished coro=<CoroutineTests.test_async_def_wrapped.<locals>.start() done, defined at /home/angwer/repos/cpython/Lib/test/test_asyncio/test_pep492.py:150> result=None created at /home/angwer/repos/cpython/Lib/asyncio/base_events.py:445> took 0.112 seconds
.Executing <Task finished coro=<CoroutineTests.test_async_def_wrapped.<locals>.start() done, defined at /home/angwer/repos/cpython/Lib/test/test_asyncio/test_pep492.py:150> result=None created at /home/angwer/repos/cpython/Lib/asyncio/base_events.py:445> took 0.104 seconds
.Executing <Task finished coro=<CoroutineTests.test_async_def_wrapped.<locals>.start() done, defined at /home/angwer/repos/cpython/Lib/test/test_asyncio/test_pep492.py:150> result=None created at /home/angwer/repos/cpython/Lib/asyncio/base_events.py:445> took 0.113 seconds
.Executing <Task finished coro=<CoroutineTests.test_async_def_wrapped.<locals>.start() done, defined at /home/angwer/repos/cpython/Lib/test/test_asyncio/test_pep492.py:150> result=None created at /home/angwer/repos/cpython/Lib/asyncio/base_events.py:445> took 0.104 seconds
.Executing <Task finished coro=<CoroutineTests.test_async_def_wrapped.<locals>.start() done, defined at /home/angwer/repos/cpython/Lib/test/test_asyncio/test_pep492.py:150> result=None created at /home/angwer/repos/cpython/Lib/asyncio/base_events.py:445> took 0.120 seconds
.Executing <Task finished coro=<CoroutineTests.test_async_def_wrapped.<locals>.start() done, defined at /home/angwer/repos/cpython/Lib/test/test_asyncio/test_pep492.py:150> result=None created at /home/angwer/repos/cpython/Lib/asyncio/base_events.py:445> took 0.142 seconds
.Executing <Task finished coro=<CoroutineTests.test_async_def_wrapped.<locals>.start() done, defined at /home/angwer/repos/cpython/Lib/test/test_asyncio/test_pep492.py:150> result=None created at /home/angwer/repos/cpython/Lib/asyncio/base_events.py:445> took 0.141 seconds
.Executing <Task finished coro=<CoroutineTests.test_async_def_wrapped.<locals>.start() done, defined at /home/angwer/repos/cpython/Lib/test/test_asyncio/test_pep492.py:150> result=None created at /home/angwer/repos/cpython/Lib/asyncio/base_events.py:445> took 0.107 seconds
.Executing <Task finished coro=<CoroutineTests.test_async_def_wrapped.<locals>.start() done, defined at /home/angwer/repos/cpython/Lib/test/test_asyncio/test_pep492.py:150> result=None created at /home/angwer/repos/cpython/Lib/asyncio/base_events.py:445> took 0.115 seconds
.
test_asyncio leaked [-2, 2, 0, 0] memory blocks, sum=0
test_asyncio failed in 4 min 27 sec

1 test failed:
    test_asyncio

git bisect blames ba7e1f9a4e06c0b4ad594fd64edcaf7292515820. Looking at the patch it looks to me the problem is in test_get_event_loop_new_process(), the pool is not shutdown.
msg292851 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-03 07:19
IMHO not calling shutdown() is a bug and Python should help developers to detect it. I proposed the issue #30244 to emit a ResourceWarning in concurrent.futures executor destructors.
msg293669 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-15 03:56
New changeset 7c278a5eeb656c2b48a85bbd761ce165f1751bb6 by Xiang Zhang in branch 'master':
bpo-30110: fix resource leak in test_asyncio.test_events (#1413)
https://github.com/python/cpython/commit/7c278a5eeb656c2b48a85bbd761ce165f1751bb6
msg293672 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-15 05:17
New changeset 0ce1f7e02d4102e8a459d1855d689c8e4613a327 by Xiang Zhang in branch '3.6':
bpo-30110: fix resource leak in test_asyncio.test_events (#1413) (#1584)
https://github.com/python/cpython/commit/0ce1f7e02d4102e8a459d1855d689c8e4613a327
msg293673 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-05-15 05:17
New changeset 51ab4ada8fc99c24d434a533693375169c097006 by Xiang Zhang in branch '3.5':
bpo-30110: fix resource leak in test_asyncio.test_events (#1413) (#1585)
https://github.com/python/cpython/commit/51ab4ada8fc99c24d434a533693375169c097006
History
Date User Action Args
2017-05-15 05:19:22xiang.zhangsetstatus: open -> closed
resolution: fixed
stage: resolved
2017-05-15 05:17:15xiang.zhangsetmessages: + msg293673
2017-05-15 05:17:03xiang.zhangsetmessages: + msg293672
2017-05-15 04:02:48xiang.zhangsetpull_requests: + pull_request1678
2017-05-15 04:02:32xiang.zhangsetpull_requests: + pull_request1677
2017-05-15 03:56:42xiang.zhangsetmessages: + msg293669
2017-05-03 07:19:52hayposetnosy: + haypo
messages: + msg292851
2017-05-03 04:19:10xiang.zhangsetpull_requests: + pull_request1521
2017-04-20 06:54:20xiang.zhangcreate