Author: gozer
Date: Thu Oct 25 01:10:37 2007
New Revision: 588160
URL: http://svn.apache.org/viewvc?rev=588160&view=rev
Log:
Merged revisions 584366-588158 via svnmerge from
https://svn.apache.org/repos/asf/perl/modperl/trunk
........
r584380 | gozer | 2007-10-12 23:48:14 -0700 (Fri, 12 Oct 2007) | 8 lines
Don't increase the refcnt of the pnotes HV* twice, we
will leak it.
Submitted-By: Torsten Foertsch <[EMAIL PROTECTED]>
Message-Id: <[EMAIL PROTECTED]>
Reviewed-By: gozer
........
r585724 | gozer | 2007-10-17 15:02:58 -0700 (Wed, 17 Oct 2007) | 7 lines
Remove unused struct member from modperl_interp_pool_t
Reviwed-By: gozer
Submitted-By: Torsten Foertsch <[EMAIL PROTECTED]>
Message-Id: <[EMAIL PROTECTED]>
........
r588156 | gozer | 2007-10-25 00:43:14 -0700 (Thu, 25 Oct 2007) | 12 lines
PerlCleanupHandler are now registered with a subpool of $(r|c)->pool,
instead of $(r|c)->pool itself, ensuring they run _before_ any other
$(r|c)->pool cleanups.
This way, pnotes can now be simply cleaned via a $(r|c)->pool cleanup,
after any PerlCleanupHandler are run.
Reviewed-By: gozer
Submitted-By: Torsten Foertsch <[EMAIL PROTECTED]>
Message-Id: <[EMAIL PROTECTED]>
........
Added:
perl/modperl/branches/threading/t/modperl/pnotes2.t
- copied unchanged from r588156, perl/modperl/trunk/t/modperl/pnotes2.t
perl/modperl/branches/threading/t/response/TestModperl/pnotes2.pm
- copied unchanged from r588156,
perl/modperl/trunk/t/response/TestModperl/pnotes2.pm
Modified:
perl/modperl/branches/threading/ (props changed)
perl/modperl/branches/threading/Changes
perl/modperl/branches/threading/src/modules/perl/modperl_config.c
perl/modperl/branches/threading/src/modules/perl/modperl_config.h
perl/modperl/branches/threading/src/modules/perl/modperl_types.h
perl/modperl/branches/threading/src/modules/perl/modperl_util.c
Propchange: perl/modperl/branches/threading/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Oct 25 01:10:37 2007
@@ -1 +1 @@
-/perl/modperl/trunk:1-584365
+/perl/modperl/trunk:1-588158
Modified: perl/modperl/branches/threading/Changes
URL:
http://svn.apache.org/viewvc/perl/modperl/branches/threading/Changes?rev=588160&r1=588159&r2=588160&view=diff
==============================================================================
--- perl/modperl/branches/threading/Changes (original)
+++ perl/modperl/branches/threading/Changes Thu Oct 25 01:10:37 2007
@@ -14,7 +14,14 @@
Expose modperl_interp_t via ModPerl::Interpreter [Torsten Foertsch]
-On Win32, embed the manifest file, if present, in mod_perl.so,
+PerlCleanupHandler are now registered with a subpool of $r->pool,
+instead of $r->pool itself, ensuring they run _before_ any other
+$r->pool cleanups [Torsten Foertsch]
+
+Fix a bug that would prevent pnotes from being cleaned up proprely
+at the end of the request [Torsten Foertsch]
+
+n Win32, embed the manifest file, if present, in mod_perl.so,
so as to work with VC 8 [Steve Hay, Randy Kobes]
Expose apr_thread_rwlock_t with the APR::ThreadRWLock module
Modified: perl/modperl/branches/threading/src/modules/perl/modperl_config.c
URL:
http://svn.apache.org/viewvc/perl/modperl/branches/threading/src/modules/perl/modperl_config.c?rev=588160&r1=588159&r2=588160&view=diff
==============================================================================
--- perl/modperl/branches/threading/src/modules/perl/modperl_config.c (original)
+++ perl/modperl/branches/threading/src/modules/perl/modperl_config.c Thu Oct
25 01:10:37 2007
@@ -362,11 +362,6 @@
retval = modperl_callback_per_dir(MP_CLEANUP_HANDLER, r, MP_HOOK_RUN_ALL);
- if (rcfg->pnotes) {
- SvREFCNT_dec(rcfg->pnotes);
- rcfg->pnotes = Nullhv;
- }
-
/* undo changes to %ENV caused by +SetupEnv, perl-script, or
* $r->subprocess_env, so the values won't persist */
if (MpReqSETUP_ENV(rcfg)) {
Modified: perl/modperl/branches/threading/src/modules/perl/modperl_config.h
URL:
http://svn.apache.org/viewvc/perl/modperl/branches/threading/src/modules/perl/modperl_config.h?rev=588160&r1=588159&r2=588160&view=diff
==============================================================================
--- perl/modperl/branches/threading/src/modules/perl/modperl_config.h (original)
+++ perl/modperl/branches/threading/src/modules/perl/modperl_config.h Thu Oct
25 01:10:37 2007
@@ -42,9 +42,15 @@
apr_status_t modperl_config_req_cleanup(void *data);
+/* use a subpool here to ensure that a PerlCleanupHandler is run before
+ * any other pool cleanup - suppools are destroyed first. Particularly a
+ * PerlCleanupHandler must run before request pnotes are dropped.
+ */
#define modperl_config_req_cleanup_register(r, rcfg) \
if (r && !MpReqCLEANUP_REGISTERED(rcfg)) { \
- apr_pool_cleanup_register(r->pool, \
+ apr_pool_t *p; \
+ apr_pool_create(&p, r->pool); \
+ apr_pool_cleanup_register(p, \
(void*)r, \
modperl_config_req_cleanup, \
apr_pool_cleanup_null); \
Modified: perl/modperl/branches/threading/src/modules/perl/modperl_types.h
URL:
http://svn.apache.org/viewvc/perl/modperl/branches/threading/src/modules/perl/modperl_types.h?rev=588160&r1=588159&r2=588160&view=diff
==============================================================================
--- perl/modperl/branches/threading/src/modules/perl/modperl_types.h (original)
+++ perl/modperl/branches/threading/src/modules/perl/modperl_types.h Thu Oct 25
01:10:37 2007
@@ -101,7 +101,6 @@
struct modperl_interp_pool_t {
server_rec *server;
modperl_tipool_t *tipool;
- modperl_tipool_config_t *tipool_cfg;
modperl_interp_t *parent; /* from which to perl_clone() */
};
Modified: perl/modperl/branches/threading/src/modules/perl/modperl_util.c
URL:
http://svn.apache.org/viewvc/perl/modperl/branches/threading/src/modules/perl/modperl_util.c?rev=588160&r1=588159&r2=588160&view=diff
==============================================================================
--- perl/modperl/branches/threading/src/modules/perl/modperl_util.c (original)
+++ perl/modperl/branches/threading/src/modules/perl/modperl_util.c Thu Oct 25
01:10:37 2007
@@ -856,33 +856,32 @@
return APR_SUCCESS;
}
+MP_INLINE
+static void *modperl_pnotes_cleanup_data(pTHX_ HV **pnotes, apr_pool_t *p) {
+#ifdef USE_ITHREADS
+ modperl_cleanup_pnotes_data_t *cleanup_data = apr_palloc(p,
sizeof(*cleanup_data));
+ cleanup_data->pnotes = pnotes;
+ cleanup_data->perl = aTHX;
+ return cleanup_data;
+#else
+ return pnotes;
+#endif
+}
+
SV *modperl_pnotes(pTHX_ HV **pnotes, SV *key, SV *val,
request_rec *r, conn_rec *c) {
SV *retval = Nullsv;
if (!*pnotes) {
- *pnotes = newHV();
+ apr_pool_t *pool = r ? r->pool : c->pool;
+ void *cleanup_data;
+ *pnotes = newHV();
- /* XXX: It would be nice to be able to do this with r->pnotes, but
- * it's currently impossible, as
modperl_config.c:modperl_config_request_cleanup()
- * is responsible for running the CleanupHandlers, and it's cleanup
callback is
- * registered very early. If we register our cleanup here, we'll be
running
- * *before* the CleanupHandlers, and they might still want to use
pnotes...
- */
- if (c && !r) {
- apr_pool_t *pool = r ? r->pool : c->pool;
-#ifdef USE_ITHREADS
- modperl_cleanup_pnotes_data_t *cleanup_data =
- apr_palloc(pool, sizeof(*cleanup_data));
- cleanup_data->pnotes = pnotes;
- cleanup_data->perl = aTHX;
-#else
- void *cleanup_data = pnotes;
-#endif
- apr_pool_cleanup_register(pool, cleanup_data,
- modperl_cleanup_pnotes,
- apr_pool_cleanup_null);
- }
+ cleanup_data = modperl_pnotes_cleanup_data(aTHX_ pnotes, pool);
+
+ apr_pool_cleanup_register(pool, cleanup_data,
+ modperl_cleanup_pnotes,
+ apr_pool_cleanup_null);
}
if (key) {
@@ -895,11 +894,9 @@
else if (hv_exists(*pnotes, k, len)) {
retval = *hv_fetch(*pnotes, k, len, FALSE);
}
- }
- else {
- retval = newRV_inc((SV *)*pnotes);
- }
- return retval ? SvREFCNT_inc(retval) : &PL_sv_undef;
+ return retval ? SvREFCNT_inc(retval) : &PL_sv_undef;
+ }
+ return newRV_inc((SV *)*pnotes);
}