You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2005/01/13 05:33:04 UTC
svn commit: r125036 - /perl/modperl/trunk/Changes /perl/modperl/trunk/src/modules/perl/mod_perl.c /perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h
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 <gi...@ActiveState.com>, Stas]
+
on Irix mod_perl.so needs to see the libperl.so symbols, which
requires the -exports option immediately before -lperl. [Gordon Lack
<gm...@ggr.co.uk>]
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 */
Re: svn commit: r125036 - /perl/modperl/trunk/Changes /perl/modperl/trunk/src/modules/perl/mod_perl.c
/perl/modperl/trunk/src/modules/perl/modperl_perl_includes.h
Posted by "Philippe M. Chiasson" <go...@ectoplasm.org>.
stas@apache.org wrote:
>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
>
>
Causes segfaults on startup on Darwin (OS X) :
#0 0x02432910 in S_mess_alloc (my_perl=0x0) at util.c:818
#1 0x02432db4 in Perl_vmess (my_perl=0x0, pat=0x252fc5c "panic:
pthread_setspecific", args=0xbffff364) at u
til.c:946
#2 0x02434260 in Perl_vcroak (my_perl=0x0, pat=0x252fc5c "panic:
pthread_setspecific", args=0xbffff364) at
util.c:1146
#3 0x02434bd4 in Perl_croak_nocontext (pat=0x252fc5c "panic:
pthread_setspecific") at util.c:1216
#4 0x023b5a4c in perl_alloc () at perl.c:144
#5 0x02206420 in modperl_startup (s=0x1807fb8, p=0x1806218) at
mod_perl.c:237
#6 0x02206350 in modperl_startup (s=0x1807fb8, p=0x1806218) at
mod_perl.c:207
#7 0x02207d84 in modperl_init (base_server=0x1807fb8, p=0x1806218) at
mod_perl.c:453
#8 0x022083e0 in modperl_hook_init (pconf=0x1806218, plog=0x0,
ptemp=0x0, s=0x1807fb8) at mod_perl.c:613
#9 0x02208438 in modperl_run () at mod_perl.c:624
#10 0x0221066c in modperl_cmd_load_module (parms=0xbffff910,
mconfig=0x1843ff8, arg=0x1971b78 "TestCompat::a
pache_module") at modperl_cmd.c:658
#11 0x00020498 in invoke_cmd (cmd=0x2240be0, parms=0xbffff910,
mconfig=0x1843ff8, args=0x1971b78 "TestCompat
::apache_module") at config.c:796
#12 0x00020bc4 in ap_walk_config_sub (current=0x1971b58,
parms=0xbffff910, section_vector=0x183de50) at conf
ig.c:1059
#13 0x00020c64 in ap_walk_config (current=0x2240be0, parms=0xbffff910,
section_vector=0x1971b58) at config.c
:1098
#14 0x00021a08 in ap_process_config_tree (s=0x1807fb8,
conftree=0x183de50, p=0x2240be0, ptemp=0xbffff910) at
config.c:1641
#15 0x0000ae18 in main (argc=11, argv=0xbffffab0) at main.c:595
Without this patch, Darwin works fine, so maybe consider this patch ?
Index: src/modules/perl/modperl_perl_includes.h
===================================================================
--- src/modules/perl/modperl_perl_includes.h (revision 125297)
+++ src/modules/perl/modperl_perl_includes.h (working copy)
@@ -142,7 +142,7 @@
/* 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
+#if defined(USE_ITHREADS) && !defined(PERL_DARWIN)
#define MP_PERL_FREE_THREAD_KEY_WORKAROUND \
if (PL_curinterp) { \
FREE_THREAD_KEY; \
--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5