Heap types implemented in C must have Py_TPFLAGS_HAVE_GC and implement tp_traverse
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
If a heap type does not have Py_TPFLAGS_HAVE_GC or doesn't not implement tp_traverse, the garbage collector may fail to collect the type and most of its instances at Python exit. The problem is worse when sub-interpreters are involved: if a sub-interpreter exits and does not clear all of its memory, the other interpreters will continue running with these leaks.
See issue gh-87138 for the rationale.
I wrote an article on the lock type which had this bug and caused a memory leak: https://vstinner.github.io/subinterpreter-leaks.html
Linked PRs
- gh-116947
- gh-138290
- gh-138327
- gh-138328
- gh-138331
- gh-138333
- gh-138427
- gh-138428
- gh-138334
- gh-138340
- gh-138341
- gh-138582
- gh-138807
- gh-139073
- gh-139474
- gh-141268
- gh-141448
- gh-152310
- gh-156034
The following PRs were directly closed because the types are immutable and empty:
- gh-138329
- gh-138330
- gh-138332
The following PRs were wrongly merged so we reverted them:
- gh-138266
- gh-138320
- gh-138322
- gh-138288
- gh-138321
- gh-138323
- gh-138289
- gh-138324
- gh-138326
PRs for reverting the above commits:
- gh-138338
- gh-138337
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con issue gh-87138 e l’articolo collegato sul tipo di lock, quindi fai l’inventario dei tipi heap C coperti dai PR collegati. Il lavoro è completato quando i tipi heap applicabili hanno Py_TPFLAGS_HAVE_GC e tp_traverse e le perdite descritte all’uscita dell’interprete e nei sub-interpreti sono state risolte.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c, python
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100