Segfault at exit when calling `sys.activate_stack_trampoline("perf")` after loading a native library
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
Crash report
What happened?
import sys, ctypes
ctypes.CDLL(None)
sys.activate_stack_trampoline("perf")
sys.activate_stack_trampoline("perf")
sys.activate_stack_trampoline("perf")
100% reproducible on 3.13.12, exits cleanly on 3.13.11.
Same between 3.14.3 and 3.14.2
Things of note:
- The crash occurs during interpreter finalization, not at the point of the call
- No exception is raised;
is_stack_trampoline_active()returnsTrueafter each call - Without
ctypes.CDLL, 3 calls don't crash (but 10 calls do crash with "no more code watcher IDs available" + segfault) - 2 calls +
ctypes.CDLLdoesn't crash; 3 calls is the threshold
Repeated calls to activate_stack_trampoline("perf") when the trampoline is already active should either be a no-op or raise an error.
CPython versions tested on:
3.13, 3.14
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.13.12 (main, Mar 10 2026, 18:17:38) [Clang 21.1.4 ]
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 eseguendo il riproduttore Python fornito su CPython 3.13.12 e 3.14.3, quindi traccia l’implementazione di sys.activate_stack_trampoline("perf") attraverso la finalizzazione dell’interprete. Controlla come le attivazioni ripetute interagiscono con ctypes.CDLL(None) e verifica che le chiamate ripetute diventino no-op oppure generino un errore, senza causare un segfault durante l’arresto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100