classification
Title: Possible reference leak in error paths of update_bases() and __build_class__
Type: Stage: resolved
Components: Versions: Python 3.11, Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: lukasz.langa, miss-islington, pablogsal
Priority: normal Keywords: patch

Created on 2021-08-07 00:25 by pablogsal, last changed 2021-08-07 14:12 by lukasz.langa. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 27647 merged pablogsal, 2021-08-07 00:26
PR 27651 merged miss-islington, 2021-08-07 10:10
PR 27652 merged miss-islington, 2021-08-07 10:10
PR 27653 merged miss-islington, 2021-08-07 10:11
Messages (7)
msg399161 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-08-07 00:25
Here:

https://github.com/python/cpython/blob/17c23167942498296f0bdfffe52e72d53d66d693/Python/bltinmodule.c#L60-L88

Seems that new_base is not properly cleaned on the error paths
msg399163 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-08-07 01:20
Oh, damn, turns out that there is a ton of reference leaks in the error path of __build_class__ as well.

These leaks have been since forever!

Curiously I found about them when debugging https://bugs.python.org/issue44524
msg399172 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-08-07 10:10
New changeset a40675c659cd8c0699f85ee9ac31660f93f8c2f5 by Pablo Galindo Salgado in branch 'main':
bpo-44856: Possible reference leak in error paths of update_bases() and __build_class__ (GH-27647)
https://github.com/python/cpython/commit/a40675c659cd8c0699f85ee9ac31660f93f8c2f5
msg399174 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-08-07 11:17
New changeset 0a423096e8d8bbe22c0fb0904f7520387a8d4247 by Miss Islington (bot) in branch '3.8':
bpo-44856: Possible reference leak in error paths of update_bases() and __build_class__ (GH-27647) (GH-27652)
https://github.com/python/cpython/commit/0a423096e8d8bbe22c0fb0904f7520387a8d4247
msg399175 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-08-07 11:17
New changeset ed718e9b07df06ea1abbe7b34c649e9d610adf86 by Miss Islington (bot) in branch '3.9':
bpo-44856: Possible reference leak in error paths of update_bases() and __build_class__ (GH-27647) (GH-27651)
https://github.com/python/cpython/commit/ed718e9b07df06ea1abbe7b34c649e9d610adf86
msg399180 - (view) Author: miss-islington (miss-islington) Date: 2021-08-07 14:03
New changeset ac8f72cd3ffa24f53c558911947c42316865683c by Miss Islington (bot) in branch '3.10':
bpo-44856: Possible reference leak in error paths of update_bases() and __build_class__ (GH-27647)
https://github.com/python/cpython/commit/ac8f72cd3ffa24f53c558911947c42316865683c
msg399182 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-08-07 14:12
Confirmed this fixed refleaks in test_typing. Backported to all branches listed on the issue.

Thanks for super-effective debugging and the fix, Pablo!
History
Date User Action Args
2021-08-07 14:12:16lukasz.langasetstatus: open -> closed
resolution: fixed
messages: + msg399182

stage: patch review -> resolved
2021-08-07 14:03:22miss-islingtonsetmessages: + msg399180
2021-08-07 11:17:44lukasz.langasetmessages: + msg399175
2021-08-07 11:17:43lukasz.langasetmessages: + msg399174
2021-08-07 10:11:10miss-islingtonsetpull_requests: + pull_request26147
2021-08-07 10:10:42lukasz.langasetnosy: + lukasz.langa
messages: + msg399172
2021-08-07 10:10:34miss-islingtonsetpull_requests: + pull_request26146
2021-08-07 10:10:29miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request26145
2021-08-07 01:20:56pablogsalsettitle: Possible reference leak in error paths of update_bases() -> Possible reference leak in error paths of update_bases() and __build_class__
2021-08-07 01:20:35pablogsalsetmessages: + msg399163
2021-08-07 00:26:56pablogsalsetkeywords: + patch
stage: patch review
pull_requests: + pull_request26141
2021-08-07 00:25:31pablogsalsetversions: + Python 3.11
2021-08-07 00:25:29pablogsalsetversions: + Python 3.8, Python 3.9, Python 3.10
2021-08-07 00:25:24pablogsalcreate