This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients giampaolo.rodola, gvanrossum, pitrou, vstinner, yselivanov, zach.ware
Date 2014-07-30.10:08:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1406714884.75.0.392365750563.issue22104@psf.upfronthosting.co.za>
In-reply-to
Content
> It may be related to the issue #17911.

I checked: it is. The strange reference count can be seen with a single test. Example:

$ ./python -m test -R 3:3: -m test_default_exc_handler_coro test_asyncio 
[1/1] test_asyncio
beginning 6 repetitions
123456
......
test_asyncio leaked [53, 53, -106] references, sum=0
test_asyncio leaked [15, 15, -30] memory blocks, sum=0
1 test failed:
    test_asyncio

This test uses a coroutine which raises an exception. The exception is stored in a Task object. But the exception contains also a traceback which indirectly creates a reference cycle. For example, the zero_error_coro() coroutine of the test uses the free variable "self".

It's very difficult to find all objects of a reference cycle. We can try to break some cycles, it's already done Task._step() which sets self to None, but it's a waste of time. IMO the correct fix is to not store frame objects in an exception: see the issue #17911.
History
Date User Action Args
2014-07-30 10:08:04vstinnersetrecipients: + vstinner, gvanrossum, pitrou, giampaolo.rodola, zach.ware, yselivanov
2014-07-30 10:08:04vstinnersetmessageid: <1406714884.75.0.392365750563.issue22104@psf.upfronthosting.co.za>
2014-07-30 10:08:04vstinnerlinkissue22104 messages
2014-07-30 10:08:04vstinnercreate