[sr-dev] git:master:251bb745: app_python3: call PyOS_AfterFork_Child() only in child processes

Anthony Alba ascanio.alba7 at gmail.com
Thu Jun 9 18:00:01 CEST 2022


Module: kamailio
Branch: master
Commit: 251bb74535594629499dfd2bb2cebfb4d728a260
URL: https://github.com/kamailio/kamailio/commit/251bb74535594629499dfd2bb2cebfb4d728a260

Author: Anthony Alba <ascanio.alba7 at gmail.com>
Committer: Anthony Alba <ascanio.alba7 at gmail.com>
Date: 2022-06-09T23:53:48+08:00

app_python3: call PyOS_AfterFork_Child() only in child processes

- GH #3125: we should not call PyOS_AfterFork_Child() in the main
process.

---

Modified: src/modules/app_python3/app_python3_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/251bb74535594629499dfd2bb2cebfb4d728a260.diff
Patch: https://github.com/kamailio/kamailio/commit/251bb74535594629499dfd2bb2cebfb4d728a260.patch

---

diff --git a/src/modules/app_python3/app_python3_mod.c b/src/modules/app_python3/app_python3_mod.c
index eb46f54f50..d250640e0c 100644
--- a/src/modules/app_python3/app_python3_mod.c
+++ b/src/modules/app_python3/app_python3_mod.c
@@ -200,19 +200,19 @@ static int child_init(int rank)
 		 * processes
 		 */
 #if PY_VERSION_HEX >= 0x03070000
-		/* this is causing abort on Python 3.8+ GH#3125
-		 * skip for now
 		PyOS_AfterFork_Parent() ;
-		*/
 #endif
 		return 0;
 	}
 	_apy_process_rank = rank;
+
+	if (rank > 0) {
 #if PY_VERSION_HEX >= 0x03070000
-	PyOS_AfterFork_Child();
+		PyOS_AfterFork_Child();
 #else
-	PyOS_AfterFork();
+		PyOS_AfterFork();
 #endif
+	}
 	if (cfg_child_init()) {
 		return -1;
 	}




More information about the sr-dev mailing list