You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tcl.apache.org by mx...@apache.org on 2021/03/12 17:43:00 UTC
[tcl-rivet] branch quattuor updated: *
src/mod_rivet_ng/mod_rivet.c: Rivet_SeekMPMBridge aligned with new
implementation made for 3.2.0. Removed call to Tcl_InitNotifier
This is an automated email from the ASF dual-hosted git repository.
mxmanghi pushed a commit to branch quattuor
in repository https://gitbox.apache.org/repos/asf/tcl-rivet.git
The following commit(s) were added to refs/heads/quattuor by this push:
new a80fe87 * src/mod_rivet_ng/mod_rivet.c: Rivet_SeekMPMBridge aligned with new implementation made for 3.2.0. Removed call to Tcl_InitNotifier
a80fe87 is described below
commit a80fe87814bc224334172a166662dba67ff38eea
Author: Massimo Manghi <mx...@apache.org>
AuthorDate: Fri Mar 12 18:42:30 2021 +0100
* src/mod_rivet_ng/mod_rivet.c: Rivet_SeekMPMBridge aligned with new implementation made for 3.2.0. Removed call to Tcl_InitNotifier
---
ChangeLog | 4 +++
src/mod_rivet_ng/mod_rivet.c | 57 +++++++++++++++++++++---------------
src/mod_rivet_ng/mod_rivet.h | 2 +-
src/mod_rivet_ng/mod_rivet_common.c | 2 +-
src/mod_rivet_ng/rivet_prefork_mpm.c | 5 +---
src/rivet.h | 10 +++----
6 files changed, 46 insertions(+), 34 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 862d991..8fb6591 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2021-03-12 Massimo Manghi <mx...@apache.org>
+ * src/mod_rivet_ng/mod_rivet.c: Rivet_SeekMPMBridge aligned with new implementation
+ made for 3.2.0. Removed call to Tcl_InitNotifier
+
2021-03-11 Massimo Manghi <mx...@apache.org>
* src/mod_rivet_ng/rivetInspect.c: add SingleThreadExit introspection
* src7mod_rivet_ng/rivet_lazy_mpm.c: fixed lazy bridge that did not build anymore
diff --git a/src/mod_rivet_ng/mod_rivet.c b/src/mod_rivet_ng/mod_rivet.c
index e3a114b..19070e5 100644
--- a/src/mod_rivet_ng/mod_rivet.c
+++ b/src/mod_rivet_ng/mod_rivet.c
@@ -103,16 +103,22 @@ DLLEXPORT module rivet_module;
static char*
Rivet_SeekMPMBridge (apr_pool_t* pool)
{
- char* mpm_prefork_bridge = "rivet_prefork_mpm.so";
- char* mpm_worker_bridge = "rivet_worker_mpm.so";
- char* mpm_bridge_path;
- int ap_mpm_result;
+ char* mpm_bridge_path;
+ int ap_mpm_result;
+ apr_status_t apr_ret;
+ apr_finfo_t finfo;
/* With the env variable RIVET_MPM_BRIDGE we have the chance to tell mod_rivet
- what bridge custom implementation we want to be loaded */
+ what bridge custom implementation we want be loaded */
if (apr_env_get (&mpm_bridge_path,"RIVET_MPM_BRIDGE",pool) == APR_SUCCESS)
{
+ if ((apr_ret = apr_stat(&finfo,mpm_bridge_path,APR_FINFO_MIN,pool)) != APR_SUCCESS)
+ {
+ ap_log_perror(APLOG_MARK,APLOG_ERR,apr_ret,pool,
+ MODNAME ": MPM bridge %s not found", module_globals->mpm_bridge);
+ exit(1);
+ }
return mpm_bridge_path;
}
@@ -120,40 +126,42 @@ Rivet_SeekMPMBridge (apr_pool_t* pool)
if (module_globals->mpm_bridge != NULL)
{
- apr_finfo_t finfo;
- char* proposed_bridge;
+ char* proposed_bridge;
- proposed_bridge = apr_pstrcat(pool,RIVET_MPM_BRIDGE_COMPOSE(module_globals->mpm_bridge),NULL);
+ proposed_bridge = apr_pstrcat(pool,RIVET_DIR,RIVET_MPM_BRIDGE_COMPOSE(module_globals->mpm_bridge),NULL);
if (apr_stat(&finfo,proposed_bridge,APR_FINFO_MIN,pool) == APR_SUCCESS)
{
mpm_bridge_path = proposed_bridge;
- }
- else if (apr_stat(&finfo,module_globals->mpm_bridge,APR_FINFO_MIN,pool) == APR_SUCCESS)
+ }
+ else if ((apr_ret = apr_stat(&finfo,module_globals->mpm_bridge,APR_FINFO_MIN,pool)) == APR_SUCCESS)
{
mpm_bridge_path = apr_pstrdup(pool,module_globals->mpm_bridge);
}
else
- {
- ap_log_perror(APLOG_MARK, APLOG_ERR, APR_EGENERAL, pool,
- MODNAME ": MPM bridge %s not found", module_globals->mpm_bridge);
+ {
+ ap_log_perror(APLOG_MARK,APLOG_ERR,apr_ret,pool,
+ MODNAME ": MPM bridge %s (%s) not found",module_globals->mpm_bridge,
+ proposed_bridge);
exit(1);
}
} else {
- /* Let's query the Rivet-MPM bridge */
+ /* MPM bridge determination heuristics */
+
+ /* Let's query the Apache server about the current MPM threaded capabilities */
if (ap_mpm_query(AP_MPMQ_IS_THREADED,&ap_mpm_result) == APR_SUCCESS)
{
if (ap_mpm_result == AP_MPMQ_NOT_SUPPORTED)
{
- /* we are forced to load the prefork MPM bridge */
+ /* Since the MPM is not threaded we assume we can load the prefork bridge */
- mpm_bridge_path = apr_pstrdup(pool,mpm_prefork_bridge);
+ mpm_bridge_path = apr_pstrcat(pool,RIVET_MPM_BRIDGE_COMPOSE("prefork"),NULL);
}
else
{
- mpm_bridge_path = apr_pstrdup(pool,mpm_worker_bridge);
+ mpm_bridge_path = apr_pstrcat(pool,RIVET_MPM_BRIDGE_COMPOSE("worker"),NULL);
}
}
else
@@ -164,9 +172,9 @@ Rivet_SeekMPMBridge (apr_pool_t* pool)
* give a default to the MPM bridge anyway
*/
- mpm_bridge_path = apr_pstrdup(pool,mpm_worker_bridge);
+ mpm_bridge_path = apr_pstrcat(pool,RIVET_MPM_BRIDGE_COMPOSE("worker"),NULL);
}
- mpm_bridge_path = apr_pstrcat(pool,RIVET_DIR,"/mpm/",mpm_bridge_path,NULL);
+ mpm_bridge_path = apr_pstrcat(pool,RIVET_DIR,mpm_bridge_path,NULL);
}
return mpm_bridge_path;
@@ -257,6 +265,9 @@ Rivet_RunServerInit (apr_pool_t *pPool, apr_pool_t *pLog, apr_pool_t *pTemp, ser
vhost_rsc->server_name = (char*) apr_pstrdup (pPool,s->server_hostname);
}
+
+ /* module globals were created and initialized during by the pre-config hook */
+
module_globals->vhosts_count = idx;
module_globals->server_interps = apr_pcalloc(pPool,module_globals->vhosts_count*sizeof(rivet_thread_interp));
@@ -490,10 +501,10 @@ static void Rivet_ChildInit (apr_pool_t *pChild, server_rec *server)
/* the thread key used to access to Tcl threads private data */
- ap_assert (apr_threadkey_private_create (&rivet_thread_key, NULL, pChild) == APR_SUCCESS);
+ // ap_assert (apr_threadkey_private_create (&rivet_thread_key, NULL, pChild) == APR_SUCCESS);
/* This code is run once per child process. The forking
- * of a child process doesn't preserve the thread where the Tcl
+ * of a child process doesn't preserve the thread where the Tcl
* notifier runs. The Notifier should have been restarted by one the
* pthread_atfork callbacks (setup in Tcl >= 8.5.14 and Tcl >= 8.6.1). In
* case pthread_atfork is not supported we unconditionally call Tcl_InitNotifier
@@ -501,7 +512,7 @@ static void Rivet_ChildInit (apr_pool_t *pChild, server_rec *server)
*/
#if !defined(HAVE_PTHREAD_ATFORK)
- Tcl_InitNotifier();
+ //Tcl_InitNotifier();
#endif
/* We can rely on the existence of module_globals only we are
@@ -557,7 +568,7 @@ static void Rivet_ChildInit (apr_pool_t *pChild, server_rec *server)
}
-static int Rivet_Handler (request_rec *r)
+static int Rivet_Handler(request_rec *r)
{
rivet_req_ctype ctype = Rivet_CheckType(r);
if (ctype == CTYPE_NOT_HANDLED) {
diff --git a/src/mod_rivet_ng/mod_rivet.h b/src/mod_rivet_ng/mod_rivet.h
index 2dbcf2a..267b89d 100644
--- a/src/mod_rivet_ng/mod_rivet.h
+++ b/src/mod_rivet_ng/mod_rivet.h
@@ -346,6 +346,6 @@ Tcl_Obj* Rivet_CurrentServerRec (Tcl_Interp* interp, server_rec* s);
#define RIVET_MPM_BRIDGE rivet_bridge_table bridge_jump_table =
-#define RIVET_MPM_BRIDGE_COMPOSE(bridge) RIVET_DIR,"/mpm/rivet_",bridge,"_mpm.so"
+#define RIVET_MPM_BRIDGE_COMPOSE(bridge) "/mpm/rivet_",bridge,"_mpm.so"
#endif /* _mod_rivet_h_ */
diff --git a/src/mod_rivet_ng/mod_rivet_common.c b/src/mod_rivet_ng/mod_rivet_common.c
index 64d05b6..a829ae1 100644
--- a/src/mod_rivet_ng/mod_rivet_common.c
+++ b/src/mod_rivet_ng/mod_rivet_common.c
@@ -507,7 +507,7 @@ rivet_thread_private* Rivet_CreatePrivateData (apr_pool_t* tPool,bool create_req
{
rivet_thread_private* private;
- ap_assert (apr_threadkey_private_get ((void **)&private,rivet_thread_key) == APR_SUCCESS);
+ //ap_assert (apr_threadkey_private_get ((void **)&private,rivet_thread_key) == APR_SUCCESS);
//apr_thread_mutex_lock(module_globals->pool_mutex);
private = apr_pcalloc (tPool,sizeof(*private));
diff --git a/src/mod_rivet_ng/rivet_prefork_mpm.c b/src/mod_rivet_ng/rivet_prefork_mpm.c
index c023b2e..eac1d55 100644
--- a/src/mod_rivet_ng/rivet_prefork_mpm.c
+++ b/src/mod_rivet_ng/rivet_prefork_mpm.c
@@ -161,8 +161,6 @@ void PreforkBridge_ChildInit (apr_pool_t* pool, server_rec* server)
rivet_thread_private* private;
rivet_server_conf* root_server_conf;
rivet_thread_interp** server_interps = module_globals->server_interps;
- //Tcl_Channel* channel;
- //server_rec* s;
RIVET_PRIVATE_DATA_NOT_NULL(rivet_thread_key,private)
@@ -172,8 +170,7 @@ void PreforkBridge_ChildInit (apr_pool_t* pool, server_rec* server)
private->ext = apr_pcalloc(private->pool,sizeof(mpm_bridge_specific));
- /*
- * Prefork bridge has inherited the parent process pool but we have
+ /* Prefork bridge has inherited the parent process pool but we have
* to initialize ourselves the request descriptor obj
*/
diff --git a/src/rivet.h b/src/rivet.h
index ddbc522..c01d9f9 100644
--- a/src/rivet.h
+++ b/src/rivet.h
@@ -59,11 +59,11 @@ static int cmd(\
Tcl_Obj *CONST objv[])
#define TCL_OBJ_CMD( name, func ) \
-Tcl_CreateObjCommand( interp, /* Tcl interpreter */\
- name, /* Function name in Tcl */\
- func, /* C function name */\
- NULL, /* Client Data */\
- (Tcl_CmdDeleteProc *)NULL /* Tcl Delete Prov */)
+Tcl_CreateObjCommand (interp, /* Tcl interpreter */\
+ name, /* Function name in Tcl */\
+ func, /* C function name */\
+ NULL, /* Client Data */\
+ (Tcl_CmdDeleteProc *)NULL /* Tcl Delete Prov */)
/* RIVET_OBJ_CMD creates a command in the RIVET_NS namespace. Commands
* are exported from the RIVET_NS (::rivet) namespace in the init.tcl
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tcl.apache.org
For additional commands, e-mail: commits-help@tcl.apache.org