Skip to content

Commit

Permalink
Changed functions to pre/post actions when forking.
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed May 14, 2019
1 parent 845cd4f commit 0f34844
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/server/mod_wsgi.c
Expand Up @@ -4345,8 +4345,13 @@ static void wsgi_python_child_init(apr_pool_t *p)
* do it if Python was initialised in parent process.
*/

if (wsgi_python_initialized && !wsgi_python_after_fork)
if (wsgi_python_initialized && !wsgi_python_after_fork) {
#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7)
PyOS_AfterFork_Child();
#else
PyOS_AfterFork();
#endif
}

/* Finalise any Python objects required by child process. */

Expand Down Expand Up @@ -10422,6 +10427,12 @@ static int wsgi_start_process(apr_pool_t *p, WSGIDaemonProcess *daemon)
wsgi_exit_daemon_process(0);
}

if (wsgi_python_initialized) {
#if PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7)
PyOS_AfterFork_Parent();
#endif
}

apr_pool_note_subprocess(p, &daemon->process, APR_KILL_AFTER_TIMEOUT);
apr_proc_other_child_register(&daemon->process, wsgi_manage_process,
daemon, NULL, p);
Expand Down

0 comments on commit 0f34844

Please sign in to comment.