classification
Title: test_asyncio refleak failures
Type: resource usage Stage: resolved
Components: Library (Lib), Tests Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pitrou Nosy List: gvanrossum, larry, pitrou, python-dev
Priority: high Keywords: patch

Created on 2013-10-19 15:04 by pitrou, last changed 2013-10-19 22:55 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
base_event_close.patch pitrou, 2013-10-19 19:10 review
Messages (6)
msg200425 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-19 15:04
Either the tests forget to cleanup resources at the end, or the library itself has resource management issues.

$ ./python -Wi -m test -R 3:3 test_asyncio
[1/1] test_asyncio
beginning 6 repetitions
123456
......
test_asyncio leaked [240, -677, -158] references, sum=-595
test_asyncio leaked [36, -116, -29] memory blocks, sum=-109
msg200482 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-19 19:10
It seems the attached patch solves it.
msg200484 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-19 19:11
(by the way, the part that really made a difference was losing the reference to the executor. I added the rest out of completeness.)
msg200508 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2013-10-19 22:32
Looks good. How about adding executor.shutdown(wait=False)? E.g.

    def close(self):
        self._ready.clear()
        self._scheduled.clear()
        executor = self._default_executor
        if executor is not None:
            self._default_executor = None
            executor.shutdown(wait=False)

If that works for you, please commit.
msg200511 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-19 22:55
New changeset 4019694a1ce4 by Antoine Pitrou in branch 'default':
Issue #19299: fix refleak test failures in test_asyncio
http://hg.python.org/cpython/rev/4019694a1ce4
msg200512 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-19 22:55
Ok, should be fixed now!
History
Date User Action Args
2013-10-19 22:55:54pitrousetstatus: open -> closed
resolution: fixed
messages: + msg200512

stage: patch review -> resolved
2013-10-19 22:55:26python-devsetnosy: + python-dev
messages: + msg200511
2013-10-19 22:32:32gvanrossumsetassignee: gvanrossum -> pitrou
messages: + msg200508
2013-10-19 19:11:34pitrousetmessages: + msg200484
2013-10-19 19:11:00pitrousetfiles: + base_event_close.patch
messages: + msg200482

assignee: gvanrossum
keywords: + patch
stage: needs patch -> patch review
2013-10-19 15:04:10pitrousetnosy: + larry
2013-10-19 15:04:04pitroucreate