Python 3.14 stack overflow detection is incompatible with C++ Boost make_fcontext() coroutines
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Python 3.14 introduced a new stack overflow detection mecanism: InternalDocs/stack_protection.md (#130396).
The KiCad application uses C++ Boost make_fcontext() coroutines which runs coroutine in their own stack.
Code example from fcontext doc:
// context-function
void f(intptr);
// creates a new stack
std::size_t size = 8192;
void* sp(std::malloc(size));
// context fc uses f() as context function
// fcontext_t is placed on top of context stack
// a pointer to fcontext_t is returned
fcontext_t fc(make_fcontext(sp,size,f));
_Py_InitializeRecursionLimits() is called in the main thread, whereas _Py_CheckRecursiveCall() is called for the first time in a coroutine (make_fcontext()).
Problem: Python detects a stack overflow because it's not aware that the stack base address and size changed when make_fcontext() was called.
pthread functions such as pthread_attr_getguardsize() are incompatible with make_fcontext().
cc @markshannon
Linked PRs
- gh-139667
- gh-139668
- gh-141551
- gh-141661
- gh-141711
- gh-141892
- gh-141944
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit InternalDocs/stack_protection.md und verfolge dann _Py_InitializeRecursionLimits() sowie den ersten _Py_CheckRecursiveCall() aus einer Boost make_fcontext()-Coroutine. Sieh dir die verknüpften PRs an, um die aktuelle Richtung zu verstehen und festzustellen, ob der Übergang von Stack-Basis und -Größe bereits behandelt ist; abgeschlossen ist die Arbeit, wenn Coroutine-Stacks keine fälschliche Stack-Overflow-Erkennung mehr auslösen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp, python
- Bereich
- operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100