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.

classification
Title: asyncio.Queue, put() leaks memory if the queue is full
Type: resource usage Stage: resolved
Components: asyncio Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Mordis, asvetlov, yselivanov
Priority: normal Keywords: patch

Created on 2018-01-16 19:53 by Mordis, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
asyncio_put_memory_leak.py Mordis, 2018-01-16 19:53 Memory leak example
Pull Requests
URL Status Linked Edit
PR 5208 merged Mordis, 2018-01-16 20:05
Messages (2)
msg310107 - (view) Author: José Melero Fernández (Mordis) * Date: 2018-01-16 19:53
Repro: asyncio queue with limited size and the queue full, call asyncio.wait_for(some_queue.put(1), some_timeout). Every canceled put produces a new item in queue._putters that is never deleted (memory leak). 

Uploaded to the issue a file with an example.

The get method had a very similar bug which was fixed in 2016-11. The related issue:
https://bugs.python.org/issue31620

I already have the code for the PR prepared, so I want to publish the link of the MR in a few of minutes.
msg310718 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-01-25 23:45
New changeset c47dacb69054f6fe1c2465df585985430f7fe366 by Yury Selivanov (José Melero Fernández) in branch 'master':
bpo-32574: Fix leaks in asyncio.Queue.put() and .get() (#5208)
https://github.com/python/cpython/commit/c47dacb69054f6fe1c2465df585985430f7fe366
History
Date User Action Args
2022-04-11 14:58:56adminsetgithub: 76755
2018-01-25 23:46:23yselivanovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-01-25 23:45:51yselivanovsetmessages: + msg310718
2018-01-21 01:34:53Mordissetversions: + Python 3.5
2018-01-16 20:05:45Mordissetkeywords: + patch
stage: patch review
pull_requests: + pull_request5062
2018-01-16 19:53:39Mordiscreate