Author: stas Date: Wed Jan 12 20:33:03 2005 New Revision: 125036 URL: http://svn.apache.org/viewcvs?view=rev&rev=125036 Log: add a 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
Modified: perl/modperl/trunk/Changes perl/modperl/trunk/src/modules/perl/mod_perl.c perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h Modified: perl/modperl/trunk/Changes Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&rev=125036&p1=perl/modperl/trunk/Changes&r1=125035&p2=perl/modperl/trunk/Changes&r2=125036 ============================================================================== --- perl/modperl/trunk/Changes (original) +++ perl/modperl/trunk/Changes Wed Jan 12 20:33:03 2005 @@ -12,6 +12,12 @@ =item 1.999_21-dev +add a 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 [Gisle Aas <[EMAIL PROTECTED]>, Stas] + on Irix mod_perl.so needs to see the libperl.so symbols, which requires the -exports option immediately before -lperl. [Gordon Lack <[EMAIL PROTECTED]>] Modified: perl/modperl/trunk/src/modules/perl/mod_perl.c Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/mod_perl.c?view=diff&rev=125036&p1=perl/modperl/trunk/src/modules/perl/mod_perl.c&r1=125035&p2=perl/modperl/trunk/src/modules/perl/mod_perl.c&r2=125036 ============================================================================== --- perl/modperl/trunk/src/modules/perl/mod_perl.c (original) +++ perl/modperl/trunk/src/modules/perl/mod_perl.c Wed Jan 12 20:33:03 2005 @@ -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(); Modified: perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h?view=diff&rev=125036&p1=perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h&r1=125035&p2=perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h&r2=125036 ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h (original) +++ perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h Wed Jan 12 20:33:03 2005 @@ -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 */