mirror of
https://github.com/python/cpython.git
synced 2026-04-14 15:50:50 +00:00
[3.14] gh-144766: Fix a crash in fork child process when perf support is enabled. (GH-144795) (#144816)
This commit is contained in:
parent
c7ceb75ada
commit
77b71ac793
3 changed files with 48 additions and 0 deletions
|
|
@ -620,6 +620,12 @@ _PyPerfTrampoline_AfterFork_Child(void)
|
|||
int was_active = _PyIsPerfTrampolineActive();
|
||||
_PyPerfTrampoline_Fini();
|
||||
if (was_active) {
|
||||
// After fork, Fini may leave the old code watcher registered
|
||||
// if trampolined code objects from the parent still exist
|
||||
// (trampoline_refcount > 0). Clear it unconditionally before
|
||||
// Init registers a new one, to prevent two watchers sharing
|
||||
// the same globals and double-decrementing trampoline_refcount.
|
||||
perf_trampoline_reset_state();
|
||||
_PyPerfTrampoline_Init(1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue