Gisle Aas wrote:
Stas Bekman <[EMAIL PROTECTED]> writes:
The latest version is:
Index: src/modules/perl/mod_perl.c
===================================================================
--- src/modules/perl/mod_perl.c (revision 124805)
+++ src/modules/perl/mod_perl.c (working copy)
@@ -573,6 +573,17 @@
MP_threads_started = 0;
MP_post_post_config_phase = 0;
+ /* with USE_ITHREADS perl leaks pthread_key_t on every
+ * perl_destruct, which becomes a problem restarts: if the OS
I would fix this comment a bit. There isn't a pthread_key_t leaked on
every perl_destruct. There is a pthread_key_t leaked on every reload
of libperl.{a,so}.
+ * limit is 1024, 1024 restarts later things will start
+ * crashing */
+ /* XXX: this is a workaround for the bug in perl, once and if it's
+ * fixed we need to disable it for the versions that have it
+ * fixed */
+ if (PL_curinterp) {
+ FREE_THREAD_KEY;
+ }
Still seems like a good idea to protect this section in a #ifdef
USE_ITHREADS block to match when PL_curinterp follow the invariant you
are testing for here.
Thanks for the advice, Gisle. Here is a new patch:
Index: src/modules/perl/modperl_perl_includes.h
===================================================================
--- src/modules/perl/modperl_perl_includes.h (revision 124805)
+++ src/modules/perl/modperl_perl_includes.h (working copy)
@@ -133,4 +133,22 @@
} STMT_END
#endif
+
+/* perl bug workaround: with USE_ITHREADS perl leaks pthread_key_t on
+ * every reload of libperl.{a,so} (it's allocated on the very first
+ * perl_alloc() and never freed). This becomes a problem on apache
+ * restart: if the OS limit is 1024, 1024 restarts later things will
+ * start crashing */
+/* XXX: once and if it's fixed in perl, we need to disable it for the
+ * versions that have it fixed, otherwise it'll crash because it'll be
+ * freed twice */
+#ifdef USE_ITHREADS
+#define MP_PERL_FREE_THREAD_KEY_WORKAROUND \
+ if (PL_curinterp) { \
+ FREE_THREAD_KEY; \
+ }
+#else
+#define MP_PERL_FREE_THREAD_KEY_WORKAROUND
+#endif
+
#endif /* MODPERL_PERL_INCLUDES_H */
Index: src/modules/perl/mod_perl.c
===================================================================
--- src/modules/perl/mod_perl.c (revision 124805)
+++ src/modules/perl/mod_perl.c (working copy)
@@ -573,6 +573,8 @@
MP_threads_started = 0;
MP_post_post_config_phase = 0;
+ MP_PERL_FREE_THREAD_KEY_WORKAROUND;
+
MP_TRACE_i(MP_FUNC, "mod_perl sys term\n");
modperl_env_unload();
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]