@@ -78,7 +78,7 @@ static apr_array_header_t *wsgi_daemon_list = NULL;
7878
7979static apr_pool_t * wsgi_parent_pool = NULL ;
8080
81- static int volatile wsgi_daemon_shutdown = 0 ;
81+ int volatile wsgi_daemon_shutdown = 0 ;
8282static int volatile wsgi_daemon_graceful = 0 ;
8383
8484#if defined(MOD_WSGI_WITH_DAEMONS )
@@ -2708,6 +2708,8 @@ static PyObject *Adapter_environ(AdapterObject *self)
27082708 object = (PyObject * )self -> input ;
27092709 PyDict_SetItemString (vars , "wsgi.input" , object );
27102710
2711+ PyDict_SetItemString (vars , "wsgi.input_terminated" , Py_True );
2712+
27112713 /* Setup file wrapper object for efficient file responses. */
27122714
27132715 PyDict_SetItemString (vars , "wsgi.file_wrapper" , (PyObject * )& Stream_Type );
@@ -4286,6 +4288,7 @@ static void wsgi_python_child_init(apr_pool_t *p)
42864288#if APR_HAS_THREADS
42874289 apr_thread_mutex_create (& wsgi_interp_lock , APR_THREAD_MUTEX_UNNESTED , p );
42884290 apr_thread_mutex_create (& wsgi_module_lock , APR_THREAD_MUTEX_UNNESTED , p );
4291+ apr_thread_mutex_create (& wsgi_shutdown_lock , APR_THREAD_MUTEX_UNNESTED , p );
42894292#endif
42904293
42914294 /*
@@ -8952,11 +8955,15 @@ static void *wsgi_deadlock_thread(apr_thread_t *thd, void *data)
89528955 while (1 ) {
89538956 apr_sleep (apr_time_from_sec (1 ));
89548957
8958+ apr_thread_mutex_lock (wsgi_shutdown_lock );
8959+
89558960 if (!wsgi_daemon_shutdown ) {
89568961 gilstate = PyGILState_Ensure ();
89578962 PyGILState_Release (gilstate );
89588963 }
89598964
8965+ apr_thread_mutex_unlock (wsgi_shutdown_lock );
8966+
89608967 apr_thread_mutex_lock (wsgi_monitor_lock );
89618968 wsgi_deadlock_shutdown_time = apr_time_now ();
89628969 wsgi_deadlock_shutdown_time += wsgi_deadlock_timeout ;
0 commit comments