Skip to content

Commit 3a39e33

Browse files
Zheaolipablogsal
andauthored
gh-131591: Reset RemoteDebuggerSuupport state after fork (#132793)
Co-authored-by: Pablo Galindo Salgado <[email protected]>
1 parent e54e828 commit 3a39e33

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Reset any :pep:`768` remote debugging pending call in children after :func:`os.fork` calls.

Modules/posixmodule.c

+10
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,14 @@ PyOS_AfterFork_Parent(void)
677677
run_at_forkers(interp->after_forkers_parent, 0);
678678
}
679679

680+
static void
681+
reset_remotedebug_data(PyThreadState *tstate)
682+
{
683+
tstate->remote_debugger_support.debugger_pending_call = 0;
684+
memset(tstate->remote_debugger_support.debugger_script_path, 0, MAX_SCRIPT_PATH_SIZE);
685+
}
686+
687+
680688
void
681689
PyOS_AfterFork_Child(void)
682690
{
@@ -710,6 +718,8 @@ PyOS_AfterFork_Child(void)
710718
goto fatal_error;
711719
}
712720

721+
reset_remotedebug_data(tstate);
722+
713723
// Remove the dead thread states. We "start the world" once we are the only
714724
// thread state left to undo the stop the world call in `PyOS_BeforeFork`.
715725
// That needs to happen before `_PyThreadState_DeleteList`, because that

0 commit comments

Comments
 (0)