You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2015/07/10 16:35:21 UTC

svn commit: r1690271 - in /tcl/rivet/trunk: ChangeLog src/mod_rivet/mod_rivet.c src/mod_rivet/rivet_prefork_mpm.c src/mod_rivet/rivet_worker_mpm.c

Author: mxmanghi
Date: Fri Jul 10 14:35:20 2015
New Revision: 1690271

URL: http://svn.apache.org/r1690271
Log:
    * src/mod_rivet/rivet_worker_mpm.c: when thread private data
    are released the correponding pointer is set to NULL in APR 
    threadkey database. It turned out a thread pool is very often
    deleted and data allcoated from it invalidated
    * src/mod_rivet/mod_rivet.c: handler private data key is
    now local to rivet_worker_mpm.c


Modified:
    tcl/rivet/trunk/ChangeLog
    tcl/rivet/trunk/src/mod_rivet/mod_rivet.c
    tcl/rivet/trunk/src/mod_rivet/rivet_prefork_mpm.c
    tcl/rivet/trunk/src/mod_rivet/rivet_worker_mpm.c

Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=1690271&r1=1690270&r2=1690271&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Fri Jul 10 14:35:20 2015
@@ -1,3 +1,11 @@
+2015-07-15 Massimo Manghi <mx...@apache.org>
+    * src/mod_rivet/rivet_worker_mpm.c: when thread private data
+    are released the correponding pointer is set to NULL in APR 
+    threadkey database. It turned out a thread pool is very often
+    deleted and data allcoated from it invalidated
+    * src/mod_rivet/mod_rivet.c: handler private data key is
+    now local to rivet_worker_mpm.c
+
 2015-07-07 Massimo Manghi <mx...@apache.org>
     * src/mod_rivet/rivet_worker_mpm.c: hopefully a method to 
     determine the thread id portable across Apache versions

Modified: tcl/rivet/trunk/src/mod_rivet/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet/mod_rivet.c?rev=1690271&r1=1690270&r2=1690271&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet/mod_rivet.c (original)
+++ tcl/rivet/trunk/src/mod_rivet/mod_rivet.c Fri Jul 10 14:35:20 2015
@@ -63,7 +63,6 @@ rivet_interp_globals    interp_globals;
 
 extern Tcl_ChannelType  RivetChan;
 apr_threadkey_t*        rivet_thread_key    = NULL;
-apr_threadkey_t*        handler_thread_key  = NULL;
 mod_rivet_globals*      module_globals      = NULL;
 
 void        Rivet_PerInterpInit (   rivet_thread_interp* interp, 

Modified: tcl/rivet/trunk/src/mod_rivet/rivet_prefork_mpm.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet/rivet_prefork_mpm.c?rev=1690271&r1=1690270&r2=1690271&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet/rivet_prefork_mpm.c (original)
+++ tcl/rivet/trunk/src/mod_rivet/rivet_prefork_mpm.c Fri Jul 10 14:35:20 2015
@@ -32,7 +32,6 @@
 
 extern mod_rivet_globals* module_globals;
 extern apr_threadkey_t*   rivet_thread_key;
-extern apr_threadkey_t*   handler_thread_key;
 
 void        Rivet_ProcessorCleanup (void *data);
 int         Rivet_InitCore          (Tcl_Interp *interp,rivet_thread_private* p); 

Modified: tcl/rivet/trunk/src/mod_rivet/rivet_worker_mpm.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/mod_rivet/rivet_worker_mpm.c?rev=1690271&r1=1690270&r2=1690271&view=diff
==============================================================================
--- tcl/rivet/trunk/src/mod_rivet/rivet_worker_mpm.c (original)
+++ tcl/rivet/trunk/src/mod_rivet/rivet_worker_mpm.c Fri Jul 10 14:35:20 2015
@@ -46,14 +46,14 @@
     #define HTTP_REQUESTS_PROC(request_proc_call) request_proc_call;
 #endif
 
-
 extern mod_rivet_globals* module_globals;
-extern apr_threadkey_t*  rivet_thread_key;
-extern apr_threadkey_t*  handler_thread_key;
+extern apr_threadkey_t*   rivet_thread_key;
+
+apr_threadkey_t*        handler_thread_key;
 
-void                  Rivet_ProcessorCleanup (void *data);
-rivet_thread_private* Rivet_VirtualHostsInterps (rivet_thread_private* private);
-rivet_thread_interp*  Rivet_NewVHostInterp(apr_pool_t* pool);
+void                    Rivet_ProcessorCleanup (void *data);
+rivet_thread_private*   Rivet_VirtualHostsInterps (rivet_thread_private* private);
+rivet_thread_interp*    Rivet_NewVHostInterp(apr_pool_t* pool);
 
 typedef struct mpm_bridge_status {
     apr_thread_t*       supervisor;
@@ -495,6 +495,9 @@ apr_status_t Worker_RequestPrivateCleanu
     ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, module_globals->server,
                  MODNAME ": request thread private data released");
 
+    /* we have to invalidate the data pointer */
+
+    apr_threadkey_private_set (NULL,handler_thread_key);
     return APR_SUCCESS;
 }
 
@@ -548,14 +551,14 @@ int Rivet_MPM_Request (request_rec* r)
 
             tpool = apr_thread_pool_get(thread_id);
             request_private = apr_pcalloc(tpool,sizeof(handler_private));
- 
-            apr_thread_cond_create (&(request_private->cond), tpool);
-            apr_thread_mutex_create (&(request_private->mutex), APR_THREAD_MUTEX_UNNESTED, tpool);
+
+            ap_assert(apr_thread_cond_create (&(request_private->cond), tpool) == APR_SUCCESS);
+            ap_assert(apr_thread_mutex_create (&(request_private->mutex), APR_THREAD_MUTEX_UNNESTED, tpool) == APR_SUCCESS);
             apr_threadkey_private_set (request_private,handler_thread_key);
 
             apr_pool_cleanup_register(tpool,(void *)request_private,Worker_RequestPrivateCleanup,apr_pool_cleanup_null);
 
-            ap_log_rerror(APLOG_MARK, APLOG_INFO, APR_SUCCESS, r,  MODNAME ": request thread private data allocated");
+            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, APR_SUCCESS, r,  MODNAME ": request thread private data allocated");
 
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org