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 pablogsal, vstinner
Date 2019-12-08.21:03:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1575839010.84.0.758314080839.issue38997@roundup.psfhosted.org>
In-reply-to
Content
This reference leak is not new :-) It exists since at least Python 2.7. Extract of Python 2.7, Python/pythonrun.c:

    sysmod = _PySys_Init();
    if (sysmod == NULL)
        Py_FatalError("Py_Initialize: can't initialize sys");
    interp->sysdict = PyModule_GetDict(sysmod);

There is a missing Py_DECREF(sysmod). It was the same bug here, except that the code was deeply refactored in the meanwhile. I fixed the reference leak in commit 080ee5a88406fb68aaab741145cd5d2a7c5f2ad6.

Next question: why did the buildbot turn red? Well, at Python exit, there are like 18k references which are never decremented at Python exit:

$ ./python -X showrefcount -c pass
[18562 refs, 6494 blocks]

Previously, the subinterpreter sys module somehow shared references with the main interpreter. With my latest changes, the subinterpreter better isolates its own sys module from the main interpreter, and so the very old bug suddenyl is "releaved".

Getting subinterpreter "right" requires to fix all these very old bugs, one by one...
History
Date User Action Args
2019-12-08 21:03:30vstinnersetrecipients: + vstinner, pablogsal
2019-12-08 21:03:30vstinnersetmessageid: <1575839010.84.0.758314080839.issue38997@roundup.psfhosted.org>
2019-12-08 21:03:30vstinnerlinkissue38997 messages
2019-12-08 21:03:29vstinnercreate