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: json module ref leaks detected by test_json
Type: resource usage Stage: resolved
Components: Extension Modules Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Segev Finer, serhiy.storchaka, vstinner
Priority: normal Keywords:

Created on 2017-07-15 10:43 by Segev Finer, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2712 merged serhiy.storchaka, 2017-07-15 10:50
PR 2727 merged serhiy.storchaka, 2017-07-16 04:33
PR 2728 merged serhiy.storchaka, 2017-07-16 04:36
Messages (7)
msg298391 - (view) Author: Segev Finer (Segev Finer) * Date: 2017-07-15 10:42
From builtbots:

test_json leaked [4, 4, 4] references, sum=12
test_json leaked [3, 3, 3] memory blocks, sum=9
1 test failed again:
    test_json

Probably unearthed by:
https://github.com/python/cpython/pull/2692
https://github.com/python/cpython/pull/2693
msg298406 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-07-15 21:40
On Python 3.6, the leaking test is:

test.test_json.test_speedups.TestEncode.test_bad_bool_args
msg298414 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-07-16 04:29
New changeset 49f6449ef4b81537c19b82329caaf60596c516c2 by Serhiy Storchaka in branch 'master':
bpo-30936: Fix a reference leak in json when fail to sort keys. (#2712)
https://github.com/python/cpython/commit/49f6449ef4b81537c19b82329caaf60596c516c2
msg298418 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-07-16 04:48
New changeset a819e5e1e66a1a5f9a7073c8a1ff3c3f304c917b by Serhiy Storchaka in branch '3.6':
[3.6] bpo-30936: Fix a reference leak in json when fail to sort keys. (GH-2712). (#2727)
https://github.com/python/cpython/commit/a819e5e1e66a1a5f9a7073c8a1ff3c3f304c917b
msg298419 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-07-16 04:50
New changeset 45c471c04553d7e4cb5c328ea1ab02d6716f2bab by Serhiy Storchaka in branch '3.5':
[3.5] bpo-30936: Fix a reference leak in json when fail to sort keys. (GH-2712). (#2728)
https://github.com/python/cpython/commit/45c471c04553d7e4cb5c328ea1ab02d6716f2bab
msg298421 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-07-16 05:15
Thank you for opening this issue Segev.

Tests added in issue30911 exposed existing leak in 3.5 and 3.6. It was not exposed in 3.7 due to different code for sort_keys. But there was a leak when sorting keys is failed. I added a new test for this case.

2.7 is not affected because C speedup is not implemented for sort_keys in 2.7.
msg298439 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-07-16 14:14
Thanks for the fixes. I checked manually 2.7, 3.5, 3.6 and master branches with "./python -m test -R 3:3 test_json": no more leak!
History
Date User Action Args
2022-04-11 14:58:49adminsetgithub: 75119
2017-07-16 14:14:47vstinnersetmessages: + msg298439
2017-07-16 05:15:26serhiy.storchakasetstatus: open -> closed
versions: - Python 2.7
messages: + msg298421

resolution: fixed
stage: patch review -> resolved
2017-07-16 04:50:39serhiy.storchakasetmessages: + msg298419
2017-07-16 04:48:10serhiy.storchakasetmessages: + msg298418
2017-07-16 04:36:36serhiy.storchakasetpull_requests: + pull_request2788
2017-07-16 04:33:07serhiy.storchakasetpull_requests: + pull_request2787
2017-07-16 04:29:19serhiy.storchakasetmessages: + msg298414
2017-07-15 21:40:30vstinnersetmessages: + msg298406
2017-07-15 10:52:00serhiy.storchakasetstage: patch review
versions: + Python 2.7, Python 3.7
2017-07-15 10:50:35serhiy.storchakasetpull_requests: + pull_request2776
2017-07-15 10:43:00Segev Finercreate