Attribute cache silently disabled after 1000 class edit, leading to poor performance
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
Bug report
Bug description:
After the changes from https://github.com/python/cpython/pull/114900 modifying a class more than 1000 times causes the attribute cache to be permanently disabled for that class. This was done to solve a crash when a class is modified more than 2**32 times ( https://github.com/python/cpython/issues/113462 )
It seems this number (1000) is too low for some real case applications.
I initially observed this as a ~50% performance regression in ERP5 performance tests when updating from python3.11 to python3.13. ERP5 is an application where classes are generated dynamically based on some configuration and some classes are modified more than 1000 times in the "normal" generation process.
This seems to also affect odoo, another ERP application, for this they resorted to using ctypes to reset the class version attribute ( https://github.com/odoo/odoo/pull/275640 )
My suggestion would be to use a much higher number before disabling the cache, 1000 is low.
CPython versions tested on:
3.13
Operating systems tested on:
Linux
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 esaminando il pull request 114900 di CPython e l’issue 113462, quindi ricostruisci come viene disabilitata la cache degli attributi dopo modifiche ripetute alle classi. Usa i casi di ERP5 e Odoo descritti nell’issue come scenari di prestazioni. Il lavoro è completato quando si evita la regressione segnalata affrontando al contempo lo scenario di crash dell’issue 113462.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- performance
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100